Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2482)

Unified Diff: chrome/browser/resources/pdf/pdf_scripting_api.js

Issue 595153003: Compile print_preview, part 5: reduce down to 104 errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@I_print_preview_4
Patch Set: fix a comment Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 8b0b9d5c0a74119b67b67a22d8bb9945efb29613..64c5059360d15fe9782fb20d44934343e1cb2cb8 100644
--- a/chrome/browser/resources/pdf/pdf_scripting_api.js
+++ b/chrome/browser/resources/pdf/pdf_scripting_api.js
@@ -7,6 +7,7 @@
* the PDF viewer so that it can be customized by things like print preview.
* @param {Window} window the window of the page containing the pdf viewer.
* @param {string} extensionUrl the url of the PDF extension.
+ * @constructor
*/
function PDFScriptingAPI(window, extensionUrl) {
this.extensionUrl_ = extensionUrl;
@@ -22,6 +23,13 @@ function PDFScriptingAPI(window, extensionUrl) {
this.setDestinationWindow(event.source);
break;
case 'viewport':
+ event.data = /**
+ * @type {{pageX: number,
+ * pageY: number,
+ * pageWidth: number,
+ * viewportWidth: number,
+ * viewportHeight: number}}
+ */(event.data);
if (this.viewportChangedCallback_)
this.viewportChangedCallback_(event.data.pageX,
event.data.pageY,
@@ -35,6 +43,7 @@ function PDFScriptingAPI(window, extensionUrl) {
break;
case 'getAccessibilityJSONReply':
if (this.accessibilityCallback_) {
+ event.data = /** @type {{json: string}} */(event.data);
this.accessibilityCallback_(event.data.json);
this.accessibilityCallback_ = null;
}
@@ -166,7 +175,8 @@ PDFScriptingAPI.prototype = {
*/
function PDFCreateOutOfProcessPlugin(src) {
var EXTENSION_URL = 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai';
- var iframe = window.document.createElement('iframe');
+ var iframe = assertInstanceof(window.document.createElement('iframe'),
+ HTMLIFrameElement);
iframe.setAttribute('src', EXTENSION_URL + '/index.html?' + src);
var client = new PDFScriptingAPI(window, EXTENSION_URL);

Powered by Google App Engine
This is Rietveld 408576698