Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: chrome/browser/resources/pdf/pdf.js

Issue 2407713002: Limit PDF helper extension to print preview only (Closed)
Patch Set: Use location.origin instead of location.ancestorOrigins. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/pdf/browser_api.js ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * @return {number} Width of a scrollbar in pixels 8 * @return {number} Width of a scrollbar in pixels
9 */ 9 */
10 function getScrollbarWidth() { 10 function getScrollbarWidth() {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 function PDFViewer(browserApi) { 94 function PDFViewer(browserApi) {
95 this.browserApi_ = browserApi; 95 this.browserApi_ = browserApi;
96 this.originalUrl_ = this.browserApi_.getStreamInfo().originalUrl; 96 this.originalUrl_ = this.browserApi_.getStreamInfo().originalUrl;
97 this.loadState_ = LoadState.LOADING; 97 this.loadState_ = LoadState.LOADING;
98 this.parentWindow_ = null; 98 this.parentWindow_ = null;
99 this.parentOrigin_ = null; 99 this.parentOrigin_ = null;
100 this.isFormFieldFocused_ = false; 100 this.isFormFieldFocused_ = false;
101 101
102 this.delayedScriptingMessages_ = []; 102 this.delayedScriptingMessages_ = [];
103 103
104 this.isPrintPreview_ = this.originalUrl_.startsWith('chrome://print'); 104 this.isPrintPreview_ = location.origin === 'chrome://print';
105 105
106 // Parse open pdf parameters. 106 // Parse open pdf parameters.
107 this.paramsParser_ = 107 this.paramsParser_ =
108 new OpenPDFParamsParser(this.getNamedDestination_.bind(this)); 108 new OpenPDFParamsParser(this.getNamedDestination_.bind(this));
109 var toolbarEnabled = 109 var toolbarEnabled =
110 this.paramsParser_.getUiUrlParams(this.originalUrl_).toolbar && 110 this.paramsParser_.getUiUrlParams(this.originalUrl_).toolbar &&
111 !this.isPrintPreview_; 111 !this.isPrintPreview_;
112 112
113 // The sizer element is placed behind the plugin element to cause scrollbars 113 // The sizer element is placed behind the plugin element to cause scrollbars
114 // to be displayed in the window. It is sized according to the document size 114 // to be displayed in the window. It is sized according to the document size
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 * Each bookmark is an Object containing a: 859 * Each bookmark is an Object containing a:
860 * - title 860 * - title
861 * - page (optional) 861 * - page (optional)
862 * - array of children (themselves bookmarks) 862 * - array of children (themselves bookmarks)
863 * @type {Array} the top-level bookmarks of the PDF. 863 * @type {Array} the top-level bookmarks of the PDF.
864 */ 864 */
865 get bookmarks() { 865 get bookmarks() {
866 return this.bookmarks_; 866 return this.bookmarks_;
867 } 867 }
868 }; 868 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/browser_api.js ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698