| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
| 6 * Create a new PDFScriptingAPI. This provides a scripting interface to | 6 * Create a new PDFScriptingAPI. This provides a scripting interface to |
| 7 * the PDF viewer so that it can be customized by things like print preview. | 7 * the PDF viewer so that it can be customized by things like print preview. |
| 8 * @param {Window} window the window of the page containing the pdf viewer. | 8 * @param {Window} window the window of the page containing the pdf viewer. |
| 9 * @param {string} extensionUrl the url of the PDF extension. | 9 * @param {string} extensionUrl the url of the PDF extension. |
| 10 */ | 10 */ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 }.bind(this), false); | 43 }.bind(this), false); |
| 44 } | 44 } |
| 45 | 45 |
| 46 PDFScriptingAPI.prototype = { | 46 PDFScriptingAPI.prototype = { |
| 47 /** | 47 /** |
| 48 * @private | 48 * @private |
| 49 * Send a message to the extension. If we try to send messages prior to the | 49 * Send a message to the extension. If we try to send messages prior to the |
| 50 * extension being ready to receive messages (i.e. before it has finished | 50 * extension being ready to receive messages (i.e. before it has finished |
| 51 * loading) we queue up the messages and flush them later. | 51 * loading) we queue up the messages and flush them later. |
| 52 * @param {Object} the message to send. | 52 * @param {Object} message The message to send. |
| 53 */ | 53 */ |
| 54 sendMessage_: function(message) { | 54 sendMessage_: function(message) { |
| 55 if (!this.pdfWindow_) { | 55 if (!this.pdfWindow_) { |
| 56 this.messageQueue_.push(message); | 56 this.messageQueue_.push(message); |
| 57 return; | 57 return; |
| 58 } | 58 } |
| 59 | 59 |
| 60 this.pdfWindow_.postMessage(message, this.extensionUrl_); | 60 this.pdfWindow_.postMessage(message, this.extensionUrl_); |
| 61 }, | 61 }, |
| 62 | 62 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 // Add the functions to the iframe so that they can be called directly. | 173 // Add the functions to the iframe so that they can be called directly. |
| 174 iframe.setViewportChangedCallback = | 174 iframe.setViewportChangedCallback = |
| 175 client.setViewportChangedCallback.bind(client); | 175 client.setViewportChangedCallback.bind(client); |
| 176 iframe.setLoadCallback = client.setLoadCallback.bind(client); | 176 iframe.setLoadCallback = client.setLoadCallback.bind(client); |
| 177 iframe.resetPrintPreviewMode = client.resetPrintPreviewMode.bind(client); | 177 iframe.resetPrintPreviewMode = client.resetPrintPreviewMode.bind(client); |
| 178 iframe.loadPreviewPage = client.loadPreviewPage.bind(client); | 178 iframe.loadPreviewPage = client.loadPreviewPage.bind(client); |
| 179 iframe.sendKeyEvent = client.sendKeyEvent.bind(client); | 179 iframe.sendKeyEvent = client.sendKeyEvent.bind(client); |
| 180 return iframe; | 180 return iframe; |
| 181 } | 181 } |
| OLD | NEW |