summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar')
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/BUILD.gn20
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html289
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js264
3 files changed, 0 insertions, 573 deletions
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/BUILD.gn b/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/BUILD.gn
deleted file mode 100644
index fdc650f55b9..00000000000
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/BUILD.gn
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//third_party/closure_compiler/compile_js.gni")
-
-js_type_check("closure_compile") {
- deps = [
- ":viewer-pdf-toolbar",
- ]
-}
-
-js_library("viewer-pdf-toolbar") {
- deps = [
- "../viewer-bookmark:viewer-bookmark",
- "../viewer-page-selector:viewer-page-selector",
- "../viewer-toolbar-dropdown:viewer-toolbar-dropdown",
- ]
- externs_list = [ "$externs_path/pending.js" ]
-}
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html b/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html
deleted file mode 100644
index e183debc86d..00000000000
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html
+++ /dev/null
@@ -1,289 +0,0 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
-<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
-<link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html">
-<link rel="import" href="chrome://resources/cr_elements/icons.html">
-<link rel="import" href="../icons.html">
-<link rel="import" href="../viewer-bookmark/viewer-bookmark.html">
-<link rel="import" href="../viewer-page-selector/viewer-page-selector.html">
-<if expr="chromeos">
-<link rel="import" href="../viewer-pen-options/viewer-pen-options.html">
-</if>
-<link rel="import" href="../viewer-toolbar-dropdown/viewer-toolbar-dropdown.html">
-
-<dom-module id="viewer-pdf-toolbar">
- <template>
- <style include="cr-hidden-style">
- :host ::selection {
- background: rgba(255, 255, 255, 0.3);
- }
-
- /* We introduce a wrapper aligner element to help with laying out the main
- * toolbar content without changing the bottom-aligned progress bar. */
- #aligner {
- align-items: center;
- display: flex;
- padding: 0 8px;
- width: 100%;
- }
-
- #title {
- flex: 5;
- font-size: 0.87rem;
- font-weight: 500;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- #pageselector-container {
- text-align: center;
- /* The container resizes according to the width of the toolbar. On small
- * screens with large numbers of pages, overflow page numbers without
- * wrapping. */
- white-space: nowrap;
- }
-
- #buttons {
- flex: 5;
- text-align: end;
- user-select: none;
- }
-
- cr-icon-button {
- --cr-icon-button-color: rgb(241, 241, 241);
- margin: 6px;
- }
-
- cr-icon-button:hover {
- background: rgba(255, 255, 255, 0.08);
- border-radius: 50%;
- }
-
- paper-progress {
- --paper-progress-active-color: var(--google-blue-300);
- --paper-progress-container-color: transparent;
- --paper-progress-height: 3px;
- transition: opacity 150ms;
- width: 100%;
- }
-
- #toolbar {
- @apply --shadow-elevation-2dp;
- background-color: rgb(50, 54, 57);
- position: relative;
- }
-
- #annotations-bar {
- align-items: center;
- background-color: rgb(32, 33, 34);
- justify-content: center;
- }
-
- #toolbar,
- #annotations-bar {
- color: rgb(241, 241, 241);
- display: flex;
- height: 48px;
- padding: 0 16px;
- }
-
- #progress-container {
- bottom: 0;
- left: 0;
- margin: 0;
- position: absolute;
- right: 0;
- top: auto;
- width: auto;
- }
-
- #pen,
- #highlighter {
- --dropdown-width: 346px;
- }
-
- #pen,
- #highlighter {
- --dropdown-open-background: rgb(50, 54, 57);
- }
-
- #eraser {
- opacity: 0.38;
- }
-
- #eraser[selected],
- #eraser:focus,
- #eraser:hover {
- opacity: 1;
- }
-
- #annotation-separator {
- background: white;
- height: 30px;
- margin-inline-end: 12px;
- margin-inline-start: 12px;
- opacity: 0.38;
- width: 1px;
- }
-
- :host([annotation-mode]) #annotate {
- background-color: rgba(255, 255, 255, 0.24);
- border-radius: 50%;
- }
-
- #bookmarks {
- margin-inline-start: 8px;
- }
-
- #pen {
- margin-inline-end: 10px;
- }
-
- #highlighter {
- margin-inline-end: 6px;
- }
-
- .invisible {
- visibility: hidden;
- }
-
- @media(max-width: 675px) {
- #bookmarks,
- #rotate-left {
- display: none;
- }
-
- #pageselector-container {
- flex: 2;
- }
- }
-
- @media(max-width: 450px) {
- #rotate-right {
- display: none;
- }
- }
-
- @media(max-width: 400px) {
- #buttons,
- #pageselector-container {
- display: none;
- }
- }
- </style>
- <div id="toolbar">
- <div id="aligner">
- <span id="title" title="{{docTitle}}">
- <span>{{docTitle}}</span>
- </span>
-
- <div id="pageselector-container">
- <viewer-page-selector id="pageselector" class="invisible"
- doc-length="{{docLength}}" page-no="{{pageNo}}"
- strings="{{strings}}">
- </viewer-page-selector>
- </div>
-
- <div id="buttons" class="invisible">
- <template is="dom-if" if="[[pdfAnnotationsEnabled]]">
- <cr-icon-button id="annotate" iron-icon="pdf:create"
- disabled="[[!annotationAvailable]]" on-click="toggleAnnotation"
- aria-label$="{{strings.tooltipAnnotate}}"
- title$="{{strings.tooltipAnnotate}}"></cr-icon-button>
- </template>
-
- <cr-icon-button id="rotate-right" iron-icon="pdf:rotate-right"
- disabled="[[annotationMode]]" on-click="rotateRight"
- aria-label$="{{strings.tooltipRotateCW}}"
- title$="{{strings.tooltipRotateCW}}"></cr-icon-button>
-
- <cr-icon-button id="download" iron-icon="cr:file-download"
- on-click="download" aria-label$="{{strings.tooltipDownload}}"
- title$="{{strings.tooltipDownload}}"></cr-icon-button>
-
- <cr-icon-button id="print" iron-icon="cr:print" on-click="print"
- hidden="[[!printingEnabled]]" title$="{{strings.tooltipPrint}}"
- aria-label$="{{strings.tooltipPrint}}"></cr-icon-button>
-
- <viewer-toolbar-dropdown id="bookmarks"
- selected
- metrics-id="bookmarks"
- hidden$="[[!bookmarks.length]]"
- open-icon="pdf:bookmark"
- closed-icon="pdf:bookmark-border"
- header="{{strings.bookmarks}}">
- <template is="dom-repeat" items="[[bookmarks]]">
- <viewer-bookmark bookmark="[[item]]" depth="0"></viewer-bookmark>
- </template>
- </viewer-toolbar-dropdown>
- </div>
- </div>
- <div id="progress-container">
- <paper-progress id="progress"
- value="[[loadProgress]]"
- indeterminate="[[annotationMode]]"></paper-progress>
- </div>
- </div>
-
- <div id="annotations-bar" hidden>
- <viewer-toolbar-dropdown id="pen"
- selected$="[[isAnnotationTool_('pen', annotationTool.tool)]]"
- open-after-select
- on-click="annotationToolClicked_"
- open-icon="pdf:marker"
- closed-icon="pdf:marker"
- dropdown-centered
- hide-header
- header$="{{strings.annotationPen}}"
- style="--pen-tip-fill: #000000">
- <viewer-pen-options
- selected-color="#000000"
- selected-size="0.1429"
- strings="[[strings]]"
- on-selected-size-changed="annotationToolOptionChanged_"
- on-selected-color-changed="annotationToolOptionChanged_">
- </viewer-pen-options>
- </viewer-toolbar-dropdown>
-
- <viewer-toolbar-dropdown id="highlighter"
- selected$="[[isAnnotationTool_('highlighter', annotationTool.tool)]]"
- open-after-select
- on-click="annotationToolClicked_"
- open-icon="pdf:highlighter"
- closed-icon="pdf:highlighter"
- dropdown-centered
- hide-header
- header$="{{strings.annotationHighlighter}}"
- style="--pen-tip-fill: #ffbc00">
- <viewer-pen-options
- selected-color="#ffbc00"
- selected-size="0.7143"
- strings="[[strings]]"
- on-selected-size-changed="annotationToolOptionChanged_"
- on-selected-color-changed="annotationToolOptionChanged_">
- </viewer-pen-options>
- </viewer-toolbar-dropdown>
-
- <cr-icon-button id="eraser"
- selected$="[[isAnnotationTool_('eraser', annotationTool.tool)]]"
- on-click="annotationToolClicked_" iron-icon="pdf:eraser"
- aria-label$="{{strings.annotationEraser}}"
- title$="{{strings.annotationEraser}}"></cr-icon-button>
-
- <div id="annotation-separator"></div>
-
- <cr-icon-button id="undo" disabled="[[!canUndoAnnotation]]"
- iron-icon="pdf:undo" on-click="undo"
- aria-label$="{{strings.annotationUndo}}"
- title$="{{strings.annotationUndo}}"></cr-icon-button>
-
- <cr-icon-button id="redo" disabled="[[!canRedoAnnotation]]"
- iron-icon="pdf:redo" on-click="redo"
- aria-label$="{{strings.annotationRedo}}"
- title$="{{strings.annotationRedo}}"></cr-icon-button>
- </div>
- </template>
- <script src="viewer-pdf-toolbar.js"></script>
-</dom-module>
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js b/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js
deleted file mode 100644
index afb87dfe6b7..00000000000
--- a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js
+++ /dev/null
@@ -1,264 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-(function() {
-Polymer({
- is: 'viewer-pdf-toolbar',
-
- properties: {
- /**
- * Whether annotation mode can be entered. This would be false if for
- * example the PDF is encrypted or password protected. Note, this is
- * true regardless of whether the feature flag is enabled.
- */
- annotationAvailable: {
- type: Boolean,
- value: true,
- },
-
- /** Whether the viewer is currently in annotation mode. */
- annotationMode: {
- type: Boolean,
- notify: true,
- value: false,
- reflectToAttribute: true,
- },
-
- /** @type {?Object} */
- annotationTool: {
- type: Object,
- value: null,
- notify: true,
- },
-
- /**
- * Tree of PDF bookmarks (empty if the document has no bookmarks).
- * @type {!Array<!Bookmark>}
- */
- bookmarks: {
- type: Array,
- value: () => [],
- },
-
- canRedoAnnotation: {
- type: Boolean,
- value: false,
- },
-
- canUndoAnnotation: {
- type: Boolean,
- value: false,
- },
-
- /** The number of pages in the PDF document. */
- docLength: Number,
-
- /** The title of the PDF document. */
- docTitle: String,
-
- /** The current loading progress of the PDF document (0 - 100). */
- loadProgress: {
- type: Number,
- observer: 'loadProgressChanged_',
- },
-
- /** Whether the toolbar is opened and visible. */
- opened: {
- type: Boolean,
- value: true,
- },
-
- /** The number of the page being viewed (1-based). */
- pageNo: Number,
-
- /** Whether the PDF Annotations feature is enabled. */
- pdfAnnotationsEnabled: {
- type: Boolean,
- value: false,
- },
-
- /** Whether the Printing feature is enabled. */
- printingEnabled: {
- type: Boolean,
- value: false,
- },
-
- strings: Object,
- },
-
- /** @type {?Object} */
- animation_: null,
-
- /**
- * @param {number} newProgress
- * @param {number} oldProgress
- * @private
- */
- loadProgressChanged_: function(newProgress, oldProgress) {
- const loaded = newProgress >= 100;
- const progressReset = newProgress < oldProgress;
- if (progressReset || loaded) {
- this.$.pageselector.classList.toggle('invisible', !loaded);
- this.$.buttons.classList.toggle('invisible', !loaded);
- this.$.progress.style.opacity = loaded ? 0 : 1;
- this.$['annotations-bar'].hidden = !loaded || !this.annotationMode;
- }
- },
-
- hide: function() {
- if (this.opened && !this.shouldKeepOpen()) {
- this.toggleVisibility();
- }
- },
-
- show: function() {
- if (!this.opened) {
- this.toggleVisibility();
- }
- },
-
- toggleVisibility: function() {
- this.opened = !this.opened;
-
- // We keep a handle on the animation in order to cancel the filling
- // behavior of previous animations.
- if (this.animation_) {
- this.animation_.cancel();
- }
-
- if (this.opened) {
- this.animation_ = this.animate(
- [{transform: 'translateY(-100%)'}, {transform: 'translateY(0%)'}], {
- duration: 250,
- easing: 'cubic-bezier(0, 0, 0.2, 1)',
- fill: 'forwards',
- });
- } else {
- this.animation_ = this.animate(
- [{transform: 'translateY(0%)'}, {transform: 'translateY(-100%)'}], {
- duration: 250,
- easing: 'cubic-bezier(0.4, 0, 1, 1)',
- fill: 'forwards',
- });
- }
- },
-
- selectPageNumber: function() {
- this.$.pageselector.select();
- },
-
- /** @return {boolean} Whether the toolbar should be kept open. */
- shouldKeepOpen: function() {
- return this.$.bookmarks.dropdownOpen || this.loadProgress < 100 ||
- this.$.pageselector.isActive() || this.annotationMode;
- },
-
- /** @return {boolean} Whether a dropdown was open and was hidden. */
- hideDropdowns: function() {
- let result = false;
- if (this.$.bookmarks.dropdownOpen) {
- this.$.bookmarks.toggleDropdown();
- result = true;
- }
- if (this.$.pen.dropdownOpen) {
- this.$.pen.toggleDropdown();
- result = true;
- }
- if (this.$.highlighter.dropdownOpen) {
- this.$.highlighter.toggleDropdown();
- result = true;
- }
- return result;
- },
-
- /** @param {number} lowerBound */
- setDropdownLowerBound: function(lowerBound) {
- this.$.bookmarks.lowerBound = lowerBound;
- },
-
- rotateRight: function() {
- this.fire('rotate-right');
- },
-
- download: function() {
- this.fire('save');
- },
-
- print: function() {
- this.fire('print');
- },
-
- undo: function() {
- this.fire('undo');
- },
-
- redo: function() {
- this.fire('redo');
- },
-
- toggleAnnotation: function() {
- this.annotationMode = !this.annotationMode;
- if (this.annotationMode) {
- // Select pen tool when entering annotation mode.
- this.updateAnnotationTool_(this.$.pen);
- }
- this.dispatchEvent(new CustomEvent('annotation-mode-toggled', {
- detail: {
- value: this.annotationMode,
- },
- }));
- },
-
- /**
- * @param {!Event} e
- * @private
- */
- annotationToolClicked_: function(e) {
- this.updateAnnotationTool_(/** @type {!HTMLElement} */ (e.currentTarget));
- },
-
- /**
- * @param {!Event} e
- * @private
- */
- annotationToolOptionChanged_: function(e) {
- const element = e.currentTarget.parentElement;
- if (!this.annotationTool || element.id != this.annotationTool.tool) {
- return;
- }
- this.updateAnnotationTool_(e.currentTarget.parentElement);
- },
-
- /**
- * @param {!HTMLElement} element
- * @private
- */
- updateAnnotationTool_: function(element) {
- const tool = element.id;
- const options = element.querySelector('viewer-pen-options') || {
- selectedSize: 1,
- selectedColor: null,
- };
- const attributeStyleMap = element.attributeStyleMap;
- attributeStyleMap.set('--pen-tip-fill', options.selectedColor);
- attributeStyleMap.set(
- '--pen-tip-border',
- options.selectedColor == '#000000' ? 'currentcolor' :
- options.selectedColor);
- this.annotationTool = {
- tool: tool,
- size: options.selectedSize,
- color: options.selectedColor,
- };
- },
-
- /**
- * @param {string} toolName
- * @return {boolean} Whether the annotation tool is using tool |toolName|.
- * @private
- */
- isAnnotationTool_: function(toolName) {
- return !!this.annotationTool && this.annotationTool.tool === toolName;
- },
-});
-})();