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 <include src="../../../../ui/webui/resources/js/util.js"> | 7 <include src="../../../../ui/webui/resources/js/util.js"> |
8 <include src="pdf_scripting_api.js"> | 8 <include src="pdf_scripting_api.js"> |
9 <include src="viewport.js"> | 9 <include src="viewport.js"> |
10 | 10 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 if (!this.passwordScreen_.active) | 273 if (!this.passwordScreen_.active) |
274 this.passwordScreen_.active = true; | 274 this.passwordScreen_.active = true; |
275 else | 275 else |
276 this.passwordScreen_.deny(); | 276 this.passwordScreen_.deny(); |
277 break; | 277 break; |
278 case 'setTranslatedStrings': | 278 case 'setTranslatedStrings': |
279 this.passwordScreen_.text = message.data.getPasswordString; | 279 this.passwordScreen_.text = message.data.getPasswordString; |
280 this.progressBar_.text = message.data.loadingString; | 280 this.progressBar_.text = message.data.loadingString; |
281 this.errorScreen_.text = message.data.loadFailedString; | 281 this.errorScreen_.text = message.data.loadFailedString; |
282 break; | 282 break; |
283 case 'getAccessibilityJSONReply': | |
Lei Zhang
2014/05/08 06:42:53
consider putting the cases in alphabetical order
raymes
2014/05/09 06:19:45
Done.
| |
284 this.sendScriptingMessage_(message.data); | |
285 break; | |
283 } | 286 } |
284 }, | 287 }, |
285 | 288 |
286 /** | 289 /** |
287 * @private | 290 * @private |
288 * A callback that's called when the viewport changes. | 291 * A callback that's called when the viewport changes. |
289 */ | 292 */ |
290 viewportChangedCallback_: function() { | 293 viewportChangedCallback_: function() { |
291 if (!this.documentDimensions_) | 294 if (!this.documentDimensions_) |
292 return; | 295 return; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 type: 'resetPrintPreviewMode', | 377 type: 'resetPrintPreviewMode', |
375 url: message.data.url, | 378 url: message.data.url, |
376 grayscale: message.data.grayscale, | 379 grayscale: message.data.grayscale, |
377 // If the PDF isn't modifiable we send 0 as the page count so that no | 380 // If the PDF isn't modifiable we send 0 as the page count so that no |
378 // blank placeholder pages get appended to the PDF. | 381 // blank placeholder pages get appended to the PDF. |
379 pageCount: (message.data.modifiable ? | 382 pageCount: (message.data.modifiable ? |
380 message.data.pageNumbers.length : 0) | 383 message.data.pageNumbers.length : 0) |
381 }); | 384 }); |
382 break; | 385 break; |
383 case 'loadPreviewPage': | 386 case 'loadPreviewPage': |
387 case 'getAccessibilityJSON': | |
384 this.plugin_.postMessage(message.data); | 388 this.plugin_.postMessage(message.data); |
385 break; | 389 break; |
386 } | 390 } |
387 | 391 |
388 }, | 392 }, |
389 | 393 |
390 /** | 394 /** |
391 * @private | 395 * @private |
392 * Send a scripting message outside the extension (typically to | 396 * Send a scripting message outside the extension (typically to |
393 * PDFScriptingAPI in a page containing the extension). | 397 * PDFScriptingAPI in a page containing the extension). |
394 * @param {Object} message the message to send. | 398 * @param {Object} message the message to send. |
395 */ | 399 */ |
396 sendScriptingMessage_: function(message) { | 400 sendScriptingMessage_: function(message) { |
397 window.parent.postMessage(message, '*'); | 401 window.parent.postMessage(message, '*'); |
398 }, | 402 }, |
399 | 403 |
400 /** | 404 /** |
401 * @type {Viewport} the viewport of the PDF viewer. | 405 * @type {Viewport} the viewport of the PDF viewer. |
402 */ | 406 */ |
403 get viewport() { | 407 get viewport() { |
404 return this.viewport_; | 408 return this.viewport_; |
405 } | 409 } |
406 }; | 410 }; |
407 | 411 |
408 var viewer = new PDFViewer(); | 412 var viewer = new PDFViewer(); |
OLD | NEW |