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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 this.sendScriptingMessage_(message.data); | 369 this.sendScriptingMessage_(message.data); |
370 break; | 370 break; |
371 case 'getPassword': | 371 case 'getPassword': |
372 // If the password screen isn't up, put it up. Otherwise we're | 372 // If the password screen isn't up, put it up. Otherwise we're |
373 // responding to an incorrect password so deny it. | 373 // responding to an incorrect password so deny it. |
374 if (!this.passwordScreen_.active) | 374 if (!this.passwordScreen_.active) |
375 this.passwordScreen_.active = true; | 375 this.passwordScreen_.active = true; |
376 else | 376 else |
377 this.passwordScreen_.deny(); | 377 this.passwordScreen_.deny(); |
378 break; | 378 break; |
| 379 case 'getSelectedTextReply': |
| 380 this.sendScriptingMessage_(message.data); |
| 381 break; |
379 case 'goToPage': | 382 case 'goToPage': |
380 this.viewport_.goToPage(message.data.page); | 383 this.viewport_.goToPage(message.data.page); |
381 break; | 384 break; |
382 case 'loadProgress': | 385 case 'loadProgress': |
383 this.updateProgress_(message.data.progress); | 386 this.updateProgress_(message.data.progress); |
384 break; | 387 break; |
385 case 'navigate': | 388 case 'navigate': |
386 if (message.data.newTab) | 389 if (message.data.newTab) |
387 window.open(message.data.url); | 390 window.open(message.data.url); |
388 else | 391 else |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 /** | 521 /** |
519 * @private | 522 * @private |
520 * Handle a scripting message from outside the extension (typically sent by | 523 * Handle a scripting message from outside the extension (typically sent by |
521 * PDFScriptingAPI in a page containing the extension) to interact with the | 524 * PDFScriptingAPI in a page containing the extension) to interact with the |
522 * plugin. | 525 * plugin. |
523 * @param {MessageObject} message the message to handle. | 526 * @param {MessageObject} message the message to handle. |
524 */ | 527 */ |
525 handleScriptingMessage: function(message) { | 528 handleScriptingMessage: function(message) { |
526 switch (message.data.type.toString()) { | 529 switch (message.data.type.toString()) { |
527 case 'getAccessibilityJSON': | 530 case 'getAccessibilityJSON': |
| 531 case 'getSelectedText': |
528 case 'loadPreviewPage': | 532 case 'loadPreviewPage': |
| 533 case 'print': |
| 534 case 'selectAll': |
529 this.plugin_.postMessage(message.data); | 535 this.plugin_.postMessage(message.data); |
530 break; | 536 break; |
531 case 'resetPrintPreviewMode': | 537 case 'resetPrintPreviewMode': |
532 if (!this.inPrintPreviewMode_) { | 538 if (!this.inPrintPreviewMode_) { |
533 this.inPrintPreviewMode_ = true; | 539 this.inPrintPreviewMode_ = true; |
534 this.viewport_.fitToPage(); | 540 this.viewport_.fitToPage(); |
535 } | 541 } |
536 | 542 |
537 // Stash the scroll location so that it can be restored when the new | 543 // Stash the scroll location so that it can be restored when the new |
538 // document is loaded. | 544 // document is loaded. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 this.streamDetails_.tabId != -1); | 607 this.streamDetails_.tabId != -1); |
602 }, | 608 }, |
603 | 609 |
604 /** | 610 /** |
605 * @type {Viewport} the viewport of the PDF viewer. | 611 * @type {Viewport} the viewport of the PDF viewer. |
606 */ | 612 */ |
607 get viewport() { | 613 get viewport() { |
608 return this.viewport_; | 614 return this.viewport_; |
609 } | 615 } |
610 }; | 616 }; |
OLD | NEW |