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