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