| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // TODO(rltoscano): Move data/* into print_preview.data namespace | 5 // TODO(rltoscano): Move data/* into print_preview.data namespace |
| 6 | 6 |
| 7 // <include src="component.js"> | 7 // <include src="component.js"> |
| 8 // <include src="print_preview_focus_manager.js"> | 8 // <include src="print_preview_focus_manager.js"> |
| 9 // | 9 // |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 * @extends {print_preview.Component} | 48 * @extends {print_preview.Component} |
| 49 */ | 49 */ |
| 50 function PrintPreview() { | 50 function PrintPreview() { |
| 51 print_preview.Component.call(this); | 51 print_preview.Component.call(this); |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * Used to communicate with Chromium's print system. | 54 * Used to communicate with Chromium's print system. |
| 55 * @type {!print_preview.NativeLayer} | 55 * @type {!print_preview.NativeLayer} |
| 56 * @private | 56 * @private |
| 57 */ | 57 */ |
| 58 this.nativeLayer_ = new print_preview.NativeLayer(); | 58 this.nativeLayer_ = print_preview.NativeLayer.getInstance(); |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * Event target that contains information about the logged in user. | 61 * Event target that contains information about the logged in user. |
| 62 * @type {!print_preview.UserInfo} | 62 * @type {!print_preview.UserInfo} |
| 63 * @private | 63 * @private |
| 64 */ | 64 */ |
| 65 this.userInfo_ = new print_preview.UserInfo(); | 65 this.userInfo_ = new print_preview.UserInfo(); |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * Application state. | 68 * Application state. |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 /** | 317 /** |
| 318 * Whether to show system dialog before next printing. | 318 * Whether to show system dialog before next printing. |
| 319 * @type {boolean} | 319 * @type {boolean} |
| 320 * @private | 320 * @private |
| 321 */ | 321 */ |
| 322 this.showSystemDialogBeforeNextPrint_ = false; | 322 this.showSystemDialogBeforeNextPrint_ = false; |
| 323 } | 323 } |
| 324 | 324 |
| 325 PrintPreview.prototype = { | 325 PrintPreview.prototype = { |
| 326 __proto__: print_preview.Component.prototype, | 326 __proto__: print_preview.Component.prototype, |
| 327 /** |
| 328 * @return {!print_preview.PreviewArea} The preview area. Used for tests. |
| 329 */ |
| 330 getPreviewArea: function() { |
| 331 return this.previewArea_; |
| 332 }, |
| 327 | 333 |
| 328 /** Sets up the page and print preview by getting the printer list. */ | 334 /** Sets up the page and print preview by getting the printer list. */ |
| 329 initialize: function() { | 335 initialize: function() { |
| 330 this.decorate($('print-preview')); | 336 this.decorate($('print-preview')); |
| 331 if (!this.previewArea_.hasCompatiblePlugin) { | 337 if (!this.previewArea_.hasCompatiblePlugin) { |
| 332 this.setIsEnabled_(false); | 338 this.setIsEnabled_(false); |
| 333 } | 339 } |
| 334 this.nativeLayer_.getInitialSettings().then( | 340 this.nativeLayer_.getInitialSettings().then( |
| 335 this.onInitialSettingsSet_.bind(this)); | 341 this.onInitialSettingsSet_.bind(this)); |
| 336 print_preview.PrintPreviewFocusManager.getInstance().initialize(); | 342 print_preview.PrintPreviewFocusManager.getInstance().initialize(); |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 // <include src="search/destination_search.js"> | 1354 // <include src="search/destination_search.js"> |
| 1349 // <include src="search/provisional_destination_resolver.js"> | 1355 // <include src="search/provisional_destination_resolver.js"> |
| 1350 | 1356 |
| 1351 window.addEventListener('DOMContentLoaded', function() { | 1357 window.addEventListener('DOMContentLoaded', function() { |
| 1352 var previewWindow = /** @type {{isTest: boolean}} */ (window); | 1358 var previewWindow = /** @type {{isTest: boolean}} */ (window); |
| 1353 if (!previewWindow.isTest) { | 1359 if (!previewWindow.isTest) { |
| 1354 var printPreview = new print_preview.PrintPreview(); | 1360 var printPreview = new print_preview.PrintPreview(); |
| 1355 printPreview.initialize(); | 1361 printPreview.initialize(); |
| 1356 } | 1362 } |
| 1357 }); | 1363 }); |
| OLD | NEW |