From 8fd9c2b363119b619ac2e6cddf77aa1173ae14a9 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Fri, 1 Dec 2017 13:08:13 +0530 Subject: [PATCH] update ui for chrome 61.0.3163.100 --- browser_api.js | 34 +- elements/shared-vars.html | 16 + elements/viewer-bookmark/viewer-bookmark.css | 52 -- elements/viewer-bookmark/viewer-bookmark.html | 58 +- elements/viewer-bookmark/viewer-bookmark.js | 156 +++--- .../viewer-bookmarks-content.html | 5 +- .../viewer-bookmarks-content.js | 4 +- .../viewer-error-screen.css | 7 - .../viewer-error-screen.html | 26 +- .../viewer-error-screen.js | 18 +- .../viewer-page-indicator.css | 35 -- .../viewer-page-indicator.html | 36 +- .../viewer-page-indicator.js | 36 +- .../viewer-page-selector.css | 53 -- .../viewer-page-selector.html | 52 +- .../viewer-page-selector.js | 16 +- .../viewer-password-screen.html | 48 +- .../viewer-password-screen.js | 47 +- .../viewer-pdf-toolbar/viewer-pdf-toolbar.css | 92 ---- .../viewer-pdf-toolbar.html | 113 +++- .../viewer-pdf-toolbar/viewer-pdf-toolbar.js | 241 ++++----- .../viewer-toolbar-dropdown.css | 59 --- .../viewer-toolbar-dropdown.html | 71 ++- .../viewer-toolbar-dropdown.js | 222 ++++---- .../viewer-zoom-button.css | 32 -- .../viewer-zoom-button.html | 34 +- .../viewer-zoom-toolbar/viewer-zoom-button.js | 28 +- .../viewer-zoom-toolbar.css | 41 -- .../viewer-zoom-toolbar.html | 41 +- .../viewer-zoom-toolbar.js | 191 +++---- gesture_detector.js | 150 ++++-- index.html | 5 +- navigator.js | 42 +- open_pdf_params_parser.js | 116 ++-- pdf.js | 316 ++++++----- pdf_fitting_type.js | 16 + pdf_scripting_api.js | 85 +-- resources.grd | 11 +- toolbar_manager.js | 6 +- viewport.js | 496 +++++++++++------- viewport_scroller.js | 42 +- zoom_manager.js | 153 +++++- 42 files changed, 1840 insertions(+), 1462 deletions(-) create mode 100644 elements/shared-vars.html delete mode 100644 elements/viewer-bookmark/viewer-bookmark.css delete mode 100644 elements/viewer-error-screen/viewer-error-screen.css delete mode 100644 elements/viewer-page-indicator/viewer-page-indicator.css delete mode 100644 elements/viewer-page-selector/viewer-page-selector.css delete mode 100644 elements/viewer-pdf-toolbar/viewer-pdf-toolbar.css delete mode 100644 elements/viewer-toolbar-dropdown/viewer-toolbar-dropdown.css delete mode 100644 elements/viewer-zoom-toolbar/viewer-zoom-button.css delete mode 100644 elements/viewer-zoom-toolbar/viewer-zoom-toolbar.css create mode 100644 pdf_fitting_type.js diff --git a/browser_api.js b/browser_api.js index 4dfa8b5..bd011a6 100644 --- a/browser_api.js +++ b/browser_api.js @@ -37,11 +37,13 @@ class BrowserApi { * upon starting the plugin. * @param {boolean} manageZoom Whether to manage zoom. */ - constructor(streamInfo, defaultZoom, initialZoom, manageZoom) { + constructor(streamInfo, defaultZoom, initialZoom) { this.streamInfo_ = streamInfo; this.defaultZoom_ = defaultZoom; this.initialZoom_ = initialZoom; - this.manageZoom_ = manageZoom; + this.zoomBehavior_ = streamInfo.embedded ? + BrowserApi.ZoomBehavior.PROPAGATE_PARENT : + BrowserApi.ZoomBehavior.MANAGE; } /** @@ -50,13 +52,13 @@ class BrowserApi { * contained in the PDF. * @param {boolean} manageZoom Whether to manage zoom. */ - static create(streamInfo, manageZoom) { + static create(streamInfo) { return Promise.all([ lookupDefaultZoom(), lookupInitialZoom() ]).then(function(zoomFactors) { return new BrowserApi( - streamInfo, zoomFactors[0], zoomFactors[1], manageZoom); + streamInfo, zoomFactors[0], zoomFactors[1]); }); } @@ -75,7 +77,7 @@ class BrowserApi { * has been updated. */ setZoom(zoom) { - if (!this.manageZoom_) + if (this.zoomBehavior_ != BrowserApi.ZoomBehavior.MANAGE) return Promise.resolve(); return cr.sendWithPromise('setZoom', zoom); } @@ -96,13 +98,21 @@ class BrowserApi { return this.initialZoom_; } + /** + * Returns how to manage the zoom. + * @return {BrowserApi.ZoomBehavior} How to manage zoom. + */ + getZoomBehavior() { + return this.zoomBehavior_; + } + /** * Adds an event listener to be notified when the browser zoom changes. * @param {function} listener The listener to be called with the new zoom * factor. */ addZoomEventListener(listener) { - if (!this.manageZoom_) + if (this.zoomBehavior_ != BrowserApi.ZoomBehavior.MANAGE) return; cr.addWebUIListener('onZoomLevelChanged', function(newZoomFactor) { @@ -111,6 +121,16 @@ class BrowserApi { } }; +/** + * Enumeration of ways to manage zoom changes. + * @enum {number} + */ +BrowserApi.ZoomBehavior = { + NONE: 0, + MANAGE: 1, + PROPAGATE_PARENT: 2 +}; + /** * Creates a BrowserApi instance for an extension not running as a mime handler. * @return {Promise} A promise to a BrowserApi instance constructed @@ -125,6 +145,6 @@ function createBrowserApi(opts) { tabId: -1, }; return new Promise(function(resolve, reject) { - resolve(BrowserApi.create(streamInfo, true)); + resolve(BrowserApi.create(streamInfo)); }); } diff --git a/elements/shared-vars.html b/elements/shared-vars.html new file mode 100644 index 0000000..f67f2b4 --- /dev/null +++ b/elements/shared-vars.html @@ -0,0 +1,16 @@ + + + diff --git a/elements/viewer-bookmark/viewer-bookmark.css b/elements/viewer-bookmark/viewer-bookmark.css deleted file mode 100644 index 74ac272..0000000 --- a/elements/viewer-bookmark/viewer-bookmark.css +++ /dev/null @@ -1,52 +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. */ - -#item { - @apply(--layout-center); - @apply(--layout-horizontal); - color: rgb(80, 80, 80); - cursor: pointer; - font-size: 77.8%; - height: 30px; - position: relative; -} - -#item:hover { - background-color: rgb(237, 237, 237); - color: rgb(20, 20, 20); -} - -paper-ripple { - /* Allowing the ripple to capture pointer events prevents a focus rectangle - * for showing up for clicks, while still allowing it with tab-navigation. - * This undoes a paper-ripple bugfix aimed at non-Chrome browsers. - * TODO(tsergeant): Improve focus in viewer-bookmark so this can be removed - * (https://crbug.com/5448190). */ - pointer-events: auto; -} - -#title { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -#expand { - --iron-icon-height: 16px; - --iron-icon-width: 16px; - --paper-icon-button-ink-color: var(--paper-grey-900); - height: 28px; - min-width: 28px; - padding: 6px; - transition: transform 150ms; - width: 28px; -} - -:host-context([dir=rtl]) #expand { - transform: rotate(180deg); -} - -:host([children-shown]) #expand { - transform: rotate(90deg); -} diff --git a/elements/viewer-bookmark/viewer-bookmark.html b/elements/viewer-bookmark/viewer-bookmark.html index 0228cb8..7320212 100644 --- a/elements/viewer-bookmark/viewer-bookmark.html +++ b/elements/viewer-bookmark/viewer-bookmark.html @@ -1,11 +1,59 @@ - + + -