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

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

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 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
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | chrome/browser/resources/pdf/viewport.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)});
},
};
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | chrome/browser/resources/pdf/viewport.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698