Chromium Code Reviews| Index: chrome/browser/resources/pdf/pdf.js |
| diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js |
| index da5793d9b0dd2e09d771c67cb3c493645f3625ad..dbe9c6e5b7813a6d5a60d6d08a3ce18354a21365 100644 |
| --- a/chrome/browser/resources/pdf/pdf.js |
| +++ b/chrome/browser/resources/pdf/pdf.js |
| @@ -245,6 +245,8 @@ function PDFViewer(browserApi) { |
| document.addEventListener('keydown', this.handleKeyEvent_.bind(this)); |
| document.addEventListener('mousemove', this.handleMouseEvent_.bind(this)); |
| document.addEventListener('mouseout', this.handleMouseEvent_.bind(this)); |
| + document.addEventListener('contextmenu', |
| + this.handleContextMenuEvent_.bind(this)); |
| var tabId = this.browserApi_.getStreamInfo().tabId; |
| this.navigator_ = new Navigator( |
| @@ -410,6 +412,18 @@ PDFViewer.prototype = { |
| this.toolbarManager_.hideToolbarsForMouseOut(); |
| }, |
| + handleContextMenuEvent_: function(e) { |
| + // Stop Chrome from popping up the context menu on long press. We need to |
| + // 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.
|
| + // touchStartEvent_) because we don't want to block two finger tap opening |
| + // the context menu. We check for firesTouchEvents in order to not block |
| + // the context menu on right click. |
| + if (e.sourceCapabilities.firesTouchEvents && |
| + !this.gestureDetector_.isTwoFingerTouch()) { |
| + e.preventDefault(); |
| + } |
| + }, |
| + |
| /** |
| * @private |
| * Rotate the plugin clockwise. |