| 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 cr.exportPath('print_preview'); | 5 cr.exportPath('print_preview'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Enumeration of IDs shown in the preview area. | 8 * Enumeration of IDs shown in the preview area. |
| 9 * @enum {string} | 9 * @enum {string} |
| 10 * @private | 10 * @private |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 print_preview.PreviewGenerator.EventType.PREVIEW_START, | 350 print_preview.PreviewGenerator.EventType.PREVIEW_START, |
| 351 this.onPreviewStart_.bind(this)); | 351 this.onPreviewStart_.bind(this)); |
| 352 this.tracker.add( | 352 this.tracker.add( |
| 353 this.previewGenerator_, | 353 this.previewGenerator_, |
| 354 print_preview.PreviewGenerator.EventType.PAGE_READY, | 354 print_preview.PreviewGenerator.EventType.PAGE_READY, |
| 355 this.onPagePreviewReady_.bind(this)); | 355 this.onPagePreviewReady_.bind(this)); |
| 356 this.tracker.add( | 356 this.tracker.add( |
| 357 this.previewGenerator_, | 357 this.previewGenerator_, |
| 358 print_preview.PreviewGenerator.EventType.DOCUMENT_READY, | 358 print_preview.PreviewGenerator.EventType.DOCUMENT_READY, |
| 359 this.onDocumentReady_.bind(this)); | 359 this.onDocumentReady_.bind(this)); |
| 360 this.previewGenerator_.addWebUIEventListeners(this.listenerTracker); |
| 360 } else { | 361 } else { |
| 361 this.showCustomMessage(loadTimeData.getString('noPlugin')); | 362 this.showCustomMessage(loadTimeData.getString('noPlugin')); |
| 362 } | 363 } |
| 363 }, | 364 }, |
| 364 | 365 |
| 365 /** @override */ | 366 /** @override */ |
| 366 exitDocument: function() { | 367 exitDocument: function() { |
| 367 print_preview.Component.prototype.exitDocument.call(this); | 368 print_preview.Component.prototype.exitDocument.call(this); |
| 368 if (this.previewGenerator_) { | |
| 369 this.previewGenerator_.removeEventListeners(); | |
| 370 } | |
| 371 this.overlayEl_ = null; | 369 this.overlayEl_ = null; |
| 372 this.openSystemDialogButton_ = null; | 370 this.openSystemDialogButton_ = null; |
| 373 }, | 371 }, |
| 374 | 372 |
| 375 /** @override */ | 373 /** @override */ |
| 376 decorateInternal: function() { | 374 decorateInternal: function() { |
| 377 this.marginControlContainer_.decorate(this.getElement()); | 375 this.marginControlContainer_.decorate(this.getElement()); |
| 378 this.overlayEl_ = this.getElement().getElementsByClassName( | 376 this.overlayEl_ = this.getElement().getElementsByClassName( |
| 379 PreviewArea.Classes_.OVERLAY)[0]; | 377 PreviewArea.Classes_.OVERLAY)[0]; |
| 380 this.openSystemDialogButton_ = this.getElement().getElementsByClassName( | 378 this.openSystemDialogButton_ = this.getElement().getElementsByClassName( |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 // pointer events will be sent to the frame. When dragging the margins, | 664 // pointer events will be sent to the frame. When dragging the margins, |
| 667 // we don't want this to happen as it can cause the margin to stop | 665 // we don't want this to happen as it can cause the margin to stop |
| 668 // being draggable. | 666 // being draggable. |
| 669 this.plugin_.style.pointerEvents = isDragging ? 'none' : 'auto'; | 667 this.plugin_.style.pointerEvents = isDragging ? 'none' : 'auto'; |
| 670 }, | 668 }, |
| 671 }; | 669 }; |
| 672 | 670 |
| 673 // Export | 671 // Export |
| 674 return {PreviewArea: PreviewArea}; | 672 return {PreviewArea: PreviewArea}; |
| 675 }); | 673 }); |
| OLD | NEW |