| OLD | NEW |
| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 this.browserApi_.setZoom.bind(this.browserApi_), | 238 this.browserApi_.setZoom.bind(this.browserApi_), |
| 239 this.browserApi_.getInitialZoom()); | 239 this.browserApi_.getInitialZoom()); |
| 240 this.viewport_.zoomManager = this.zoomManager_; | 240 this.viewport_.zoomManager = this.zoomManager_; |
| 241 this.browserApi_.addZoomEventListener( | 241 this.browserApi_.addZoomEventListener( |
| 242 this.zoomManager_.onBrowserZoomChange.bind(this.zoomManager_)); | 242 this.zoomManager_.onBrowserZoomChange.bind(this.zoomManager_)); |
| 243 | 243 |
| 244 // Setup the keyboard event listener. | 244 // Setup the keyboard event listener. |
| 245 document.addEventListener('keydown', this.handleKeyEvent_.bind(this)); | 245 document.addEventListener('keydown', this.handleKeyEvent_.bind(this)); |
| 246 document.addEventListener('mousemove', this.handleMouseEvent_.bind(this)); | 246 document.addEventListener('mousemove', this.handleMouseEvent_.bind(this)); |
| 247 document.addEventListener('mouseout', this.handleMouseEvent_.bind(this)); | 247 document.addEventListener('mouseout', this.handleMouseEvent_.bind(this)); |
| 248 document.addEventListener('contextmenu', | |
| 249 this.handleContextMenuEvent_.bind(this)); | |
| 250 | 248 |
| 251 var tabId = this.browserApi_.getStreamInfo().tabId; | 249 var tabId = this.browserApi_.getStreamInfo().tabId; |
| 252 this.navigator_ = new Navigator( | 250 this.navigator_ = new Navigator( |
| 253 this.originalUrl_, this.viewport_, this.paramsParser_, | 251 this.originalUrl_, this.viewport_, this.paramsParser_, |
| 254 new NavigatorDelegate(tabId)); | 252 new NavigatorDelegate(tabId)); |
| 255 this.viewportScroller_ = | 253 this.viewportScroller_ = |
| 256 new ViewportScroller(this.viewport_, this.plugin_, window); | 254 new ViewportScroller(this.viewport_, this.plugin_, window); |
| 257 | 255 |
| 258 // Request translated strings. | 256 // Request translated strings. |
| 259 chrome.resourcesPrivate.getStrings('pdf', this.handleStrings_.bind(this)); | 257 chrome.resourcesPrivate.getStrings('pdf', this.handleStrings_.bind(this)); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 } | 403 } |
| 406 }, | 404 }, |
| 407 | 405 |
| 408 handleMouseEvent_: function(e) { | 406 handleMouseEvent_: function(e) { |
| 409 if (e.type == 'mousemove') | 407 if (e.type == 'mousemove') |
| 410 this.toolbarManager_.handleMouseMove(e); | 408 this.toolbarManager_.handleMouseMove(e); |
| 411 else if (e.type == 'mouseout') | 409 else if (e.type == 'mouseout') |
| 412 this.toolbarManager_.hideToolbarsForMouseOut(); | 410 this.toolbarManager_.hideToolbarsForMouseOut(); |
| 413 }, | 411 }, |
| 414 | 412 |
| 415 handleContextMenuEvent_: function(e) { | |
| 416 // Stop Chrome from popping up the context menu on long press. We need to | |
| 417 // make sure the start event did not have 2 touches because we don't want | |
| 418 // to block two finger tap opening the context menu. We check for | |
| 419 // firesTouchEvents in order to not block the context menu on right click. | |
| 420 if (e.sourceCapabilities.firesTouchEvents && | |
| 421 !this.gestureDetector_.wasTwoFingerTouch()) { | |
| 422 e.preventDefault(); | |
| 423 } | |
| 424 }, | |
| 425 | |
| 426 /** | 413 /** |
| 427 * @private | 414 * @private |
| 428 * Rotate the plugin clockwise. | 415 * Rotate the plugin clockwise. |
| 429 */ | 416 */ |
| 430 rotateClockwise_: function() { | 417 rotateClockwise_: function() { |
| 431 this.plugin_.postMessage({ | 418 this.plugin_.postMessage({ |
| 432 type: 'rotateClockwise' | 419 type: 'rotateClockwise' |
| 433 }); | 420 }); |
| 434 }, | 421 }, |
| 435 | 422 |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 * Each bookmark is an Object containing a: | 923 * Each bookmark is an Object containing a: |
| 937 * - title | 924 * - title |
| 938 * - page (optional) | 925 * - page (optional) |
| 939 * - array of children (themselves bookmarks) | 926 * - array of children (themselves bookmarks) |
| 940 * @type {Array} the top-level bookmarks of the PDF. | 927 * @type {Array} the top-level bookmarks of the PDF. |
| 941 */ | 928 */ |
| 942 get bookmarks() { | 929 get bookmarks() { |
| 943 return this.bookmarks_; | 930 return this.bookmarks_; |
| 944 } | 931 } |
| 945 }; | 932 }; |
| OLD | NEW |