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

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

Issue 2402873002: Add check for file:-navigations from PDFs (Closed)
Patch Set: Put logic at single location, add test 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
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 this.browserApi_.getInitialZoom()); 226 this.browserApi_.getInitialZoom());
227 this.browserApi_.addZoomEventListener( 227 this.browserApi_.addZoomEventListener(
228 this.zoomManager_.onBrowserZoomChange.bind(this.zoomManager_)); 228 this.zoomManager_.onBrowserZoomChange.bind(this.zoomManager_));
229 229
230 // Setup the keyboard event listener. 230 // Setup the keyboard event listener.
231 document.addEventListener('keydown', this.handleKeyEvent_.bind(this)); 231 document.addEventListener('keydown', this.handleKeyEvent_.bind(this));
232 document.addEventListener('mousemove', this.handleMouseEvent_.bind(this)); 232 document.addEventListener('mousemove', this.handleMouseEvent_.bind(this));
233 document.addEventListener('mouseout', this.handleMouseEvent_.bind(this)); 233 document.addEventListener('mouseout', this.handleMouseEvent_.bind(this));
234 234
235 var isInTab = this.browserApi_.getStreamInfo().tabId != -1; 235 var isInTab = this.browserApi_.getStreamInfo().tabId != -1;
236 var isSourceFileUrl = this.originalUrl_.startsWith('file://');
237 this.navigator_ = new Navigator( 236 this.navigator_ = new Navigator(
238 this.originalUrl_, this.viewport_, this.paramsParser_, 237 this.originalUrl_, this.viewport_, this.paramsParser_,
239 new NavigatorDelegate(isInTab, isSourceFileUrl)); 238 new NavigatorDelegate(isInTab));
240 this.viewportScroller_ = 239 this.viewportScroller_ =
241 new ViewportScroller(this.viewport_, this.plugin_, window); 240 new ViewportScroller(this.viewport_, this.plugin_, window);
242 241
243 // Request translated strings. 242 // Request translated strings.
244 chrome.resourcesPrivate.getStrings('pdf', this.handleStrings_.bind(this)); 243 chrome.resourcesPrivate.getStrings('pdf', this.handleStrings_.bind(this));
245 } 244 }
246 245
247 PDFViewer.prototype = { 246 PDFViewer.prototype = {
248 /** 247 /**
249 * @private 248 * @private
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 * Each bookmark is an Object containing a: 858 * Each bookmark is an Object containing a:
860 * - title 859 * - title
861 * - page (optional) 860 * - page (optional)
862 * - array of children (themselves bookmarks) 861 * - array of children (themselves bookmarks)
863 * @type {Array} the top-level bookmarks of the PDF. 862 * @type {Array} the top-level bookmarks of the PDF.
864 */ 863 */
865 get bookmarks() { 864 get bookmarks() {
866 return this.bookmarks_; 865 return this.bookmarks_;
867 } 866 }
868 }; 867 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698