Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 cr.define('print_preview', function() { | |
| 6 /** | |
| 7 * Test version of the print preview plugin | |
| 8 * @param {print_preview.PreviewArea} The PreviewArea that owns this plugin. | |
|
dpapad
2017/07/06 00:24:17
!print_preview.PreviewArea
rbpotter
2017/07/06 01:57:27
Done.
| |
| 9 * @constructor | |
| 10 */ | |
| 11 function PDFPluginStub(area) { | |
|
dpapad
2017/07/06 00:24:17
Can we use the new ES6 class syntax, which we rece
rbpotter
2017/07/06 01:57:28
Done.
| |
| 12 /** @private {Object} The callback to run when the plugin has loaded. */ | |
|
dpapad
2017/07/06 00:24:17
?Function
rbpotter
2017/07/06 01:57:27
Done.
| |
| 13 this.loadCallback_ = null; | |
| 14 | |
| 15 /** @private {EventTracker} The plugin stub's event tracker. */ | |
|
dpapad
2017/07/06 00:24:17
!EventTracker
rbpotter
2017/07/06 01:57:28
Done.
| |
| 16 this.tracker_ = new EventTracker(); | |
| 17 | |
| 18 // Call documentLoadComplete as soon as the preview area starts the preview. | |
| 19 this.tracker_.add( | |
| 20 area, | |
| 21 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_IN_PROGRESS, | |
| 22 this.documentLoadComplete.bind(this)); | |
| 23 } | |
| 24 | |
| 25 PDFPluginStub.prototype = { | |
| 26 /** | |
| 27 * @param {Object} callback The callback to run when the plugin has loaded. | |
| 28 */ | |
| 29 setLoadCallback: function(callback) { | |
| 30 this.loadCallback_ = callback; | |
| 31 }, | |
| 32 | |
| 33 documentLoadComplete: function() { | |
| 34 if (this.loadCallback_) | |
| 35 this.loadCallback_(); | |
| 36 }, | |
| 37 | |
| 38 /** | |
| 39 * Stubbed out since some tests result in a call. | |
| 40 * @param {string} url The url to initialize the plugin to. | |
| 41 * @param {boolean} color Whether the preview should be in color. | |
| 42 * @param {Array<int>} pages The pages to preview. | |
|
dpapad
2017/07/06 00:24:17
!Array<number>
rbpotter
2017/07/06 01:57:28
Done.
| |
| 43 * @param {boolean} modifiable Whether the source document is modifiable. | |
| 44 */ | |
| 45 resetPrintPreviewMode: function(url, color, pages, modifiable) {}, | |
| 46 }; | |
| 47 | |
| 48 return { | |
| 49 PDFPluginStub: PDFPluginStub, | |
| 50 }; | |
| 51 }); | |
| OLD | NEW |