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)); | |
248 | 250 |
249 var tabId = this.browserApi_.getStreamInfo().tabId; | 251 var tabId = this.browserApi_.getStreamInfo().tabId; |
250 this.navigator_ = new Navigator( | 252 this.navigator_ = new Navigator( |
251 this.originalUrl_, this.viewport_, this.paramsParser_, | 253 this.originalUrl_, this.viewport_, this.paramsParser_, |
252 new NavigatorDelegate(tabId)); | 254 new NavigatorDelegate(tabId)); |
253 this.viewportScroller_ = | 255 this.viewportScroller_ = |
254 new ViewportScroller(this.viewport_, this.plugin_, window); | 256 new ViewportScroller(this.viewport_, this.plugin_, window); |
255 | 257 |
256 // Request translated strings. | 258 // Request translated strings. |
257 chrome.resourcesPrivate.getStrings('pdf', this.handleStrings_.bind(this)); | 259 chrome.resourcesPrivate.getStrings('pdf', this.handleStrings_.bind(this)); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 } | 405 } |
404 }, | 406 }, |
405 | 407 |
406 handleMouseEvent_: function(e) { | 408 handleMouseEvent_: function(e) { |
407 if (e.type == 'mousemove') | 409 if (e.type == 'mousemove') |
408 this.toolbarManager_.handleMouseMove(e); | 410 this.toolbarManager_.handleMouseMove(e); |
409 else if (e.type == 'mouseout') | 411 else if (e.type == 'mouseout') |
410 this.toolbarManager_.hideToolbarsForMouseOut(); | 412 this.toolbarManager_.hideToolbarsForMouseOut(); |
411 }, | 413 }, |
412 | 414 |
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 had 2 touches (which corresponds to our | |
Kevin McNee
2017/05/02 23:18:19
Don't you mean "the start event did not have 2 tou
dsinclair
2017/05/03 14:18:40
Done.
| |
418 // touchStartEvent_) because we don't want to block two finger tap opening | |
419 // the context menu. We check for firesTouchEvents in order to not block | |
420 // the context menu on right click. | |
421 if (e.sourceCapabilities.firesTouchEvents && | |
422 !this.gestureDetector_.isTwoFingerTouch()) { | |
423 e.preventDefault(); | |
424 } | |
425 }, | |
426 | |
413 /** | 427 /** |
414 * @private | 428 * @private |
415 * Rotate the plugin clockwise. | 429 * Rotate the plugin clockwise. |
416 */ | 430 */ |
417 rotateClockwise_: function() { | 431 rotateClockwise_: function() { |
418 this.plugin_.postMessage({ | 432 this.plugin_.postMessage({ |
419 type: 'rotateClockwise' | 433 type: 'rotateClockwise' |
420 }); | 434 }); |
421 }, | 435 }, |
422 | 436 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
923 * Each bookmark is an Object containing a: | 937 * Each bookmark is an Object containing a: |
924 * - title | 938 * - title |
925 * - page (optional) | 939 * - page (optional) |
926 * - array of children (themselves bookmarks) | 940 * - array of children (themselves bookmarks) |
927 * @type {Array} the top-level bookmarks of the PDF. | 941 * @type {Array} the top-level bookmarks of the PDF. |
928 */ | 942 */ |
929 get bookmarks() { | 943 get bookmarks() { |
930 return this.bookmarks_; | 944 return this.bookmarks_; |
931 } | 945 } |
932 }; | 946 }; |
OLD | NEW |