| Index: chrome/browser/resources/pdf/pdf_scripting_api.js
|
| diff --git a/chrome/browser/resources/pdf/pdf_scripting_api.js b/chrome/browser/resources/pdf/pdf_scripting_api.js
|
| index 712e390207e2cb443611cab2cfcf26eddbfb633b..aee1841e759d756e3d0fe0da2c1a4f5329c28658 100644
|
| --- a/chrome/browser/resources/pdf/pdf_scripting_api.js
|
| +++ b/chrome/browser/resources/pdf/pdf_scripting_api.js
|
| @@ -38,11 +38,7 @@ function SerializeKeyEvent(event) {
|
| * An enum containing a value specifying whether the PDF is currently loading,
|
| * has finished loading or failed to load.
|
| */
|
| -var LoadState = {
|
| - LOADING: 'loading',
|
| - SUCCESS: 'success',
|
| - FAILED: 'failed'
|
| -};
|
| +var LoadState = {LOADING: 'loading', SUCCESS: 'success', FAILED: 'failed'};
|
|
|
| /**
|
| * Create a new PDFScriptingAPI. This provides a scripting interface to
|
| @@ -58,18 +54,16 @@ function PDFScriptingAPI(window, plugin) {
|
| window.addEventListener('message', function(event) {
|
| if (event.origin != 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai' &&
|
| event.origin != 'chrome://print') {
|
| - console.error('Received message that was not from the extension: ' +
|
| - event);
|
| + console.error(
|
| + 'Received message that was not from the extension: ' + event);
|
| return;
|
| }
|
| switch (event.data.type) {
|
| case 'viewport':
|
| if (this.viewportChangedCallback_)
|
| - this.viewportChangedCallback_(event.data.pageX,
|
| - event.data.pageY,
|
| - event.data.pageWidth,
|
| - event.data.viewportWidth,
|
| - event.data.viewportHeight);
|
| + this.viewportChangedCallback_(
|
| + event.data.pageX, event.data.pageY, event.data.pageWidth,
|
| + event.data.viewportWidth, event.data.viewportHeight);
|
| break;
|
| case 'documentLoaded':
|
| this.loadState_ = event.data.load_state;
|
| @@ -105,20 +99,18 @@ PDFScriptingAPI.prototype = {
|
| this.pendingScriptingMessages_.push(message);
|
| },
|
|
|
| - /**
|
| - * Sets the plugin element containing the PDF viewer. The element will usually
|
| - * be passed into the PDFScriptingAPI constructor but may also be set later.
|
| - * @param {Object} plugin the plugin element containing the PDF viewer.
|
| - */
|
| + /**
|
| + * Sets the plugin element containing the PDF viewer. The element will usually
|
| + * be passed into the PDFScriptingAPI constructor but may also be set later.
|
| + * @param {Object} plugin the plugin element containing the PDF viewer.
|
| + */
|
| setPlugin: function(plugin) {
|
| this.plugin_ = plugin;
|
|
|
| if (this.plugin_) {
|
| // Send a message to ensure the postMessage channel is initialized which
|
| // allows us to receive messages.
|
| - this.sendMessage_({
|
| - type: 'initialize'
|
| - });
|
| + this.sendMessage_({type: 'initialize'});
|
| // Flush pending messages.
|
| while (this.pendingScriptingMessages_.length > 0)
|
| this.sendMessage_(this.pendingScriptingMessages_.shift());
|
| @@ -176,11 +168,7 @@ PDFScriptingAPI.prototype = {
|
| * @param {number} index the index of the page to load.
|
| */
|
| loadPreviewPage: function(url, index) {
|
| - this.sendMessage_({
|
| - type: 'loadPreviewPage',
|
| - url: url,
|
| - index: index
|
| - });
|
| + this.sendMessage_({type: 'loadPreviewPage', url: url, index: index});
|
| },
|
|
|
| /**
|
| @@ -188,9 +176,7 @@ PDFScriptingAPI.prototype = {
|
| * load.
|
| */
|
| selectAll: function() {
|
| - this.sendMessage_({
|
| - type: 'selectAll'
|
| - });
|
| + this.sendMessage_({type: 'selectAll'});
|
| },
|
|
|
| /**
|
| @@ -204,9 +190,7 @@ PDFScriptingAPI.prototype = {
|
| if (this.selectedTextCallback_)
|
| return false;
|
| this.selectedTextCallback_ = callback;
|
| - this.sendMessage_({
|
| - type: 'getSelectedText'
|
| - });
|
| + this.sendMessage_({type: 'getSelectedText'});
|
| return true;
|
| },
|
|
|
| @@ -214,9 +198,7 @@ PDFScriptingAPI.prototype = {
|
| * Print the document. May only be called after document load.
|
| */
|
| print: function() {
|
| - this.sendMessage_({
|
| - type: 'print'
|
| - });
|
| + this.sendMessage_({type: 'print'});
|
| },
|
|
|
| /**
|
| @@ -224,10 +206,8 @@ PDFScriptingAPI.prototype = {
|
| * @param {Event} keyEvent the key event to send to the extension.
|
| */
|
| sendKeyEvent: function(keyEvent) {
|
| - this.sendMessage_({
|
| - type: 'sendKeyEvent',
|
| - keyEvent: SerializeKeyEvent(keyEvent)
|
| - });
|
| + this.sendMessage_(
|
| + {type: 'sendKeyEvent', keyEvent: SerializeKeyEvent(keyEvent)});
|
| },
|
| };
|
|
|
|
|