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.listenerTracker.add( |
| 361 'page-count-ready', |
| 362 this.previewGenerator_.onPageCountReady_.bind( |
| 363 this.previewGenerator_)); |
| 364 this.listenerTracker.add( |
| 365 'page-layout-ready', |
| 366 this.previewGenerator_.onPageLayoutReady_.bind( |
| 367 this.previewGenerator_)); |
| 368 this.listenerTracker.add( |
| 369 'page-preview-ready', |
| 370 this.previewGenerator_.onPagePreviewReady_.bind( |
| 371 this.previewGenerator_)); |
360 } else { | 372 } else { |
361 this.showCustomMessage(loadTimeData.getString('noPlugin')); | 373 this.showCustomMessage(loadTimeData.getString('noPlugin')); |
362 } | 374 } |
363 }, | 375 }, |
364 | 376 |
365 /** @override */ | 377 /** @override */ |
366 exitDocument: function() { | 378 exitDocument: function() { |
367 print_preview.Component.prototype.exitDocument.call(this); | 379 print_preview.Component.prototype.exitDocument.call(this); |
368 if (this.previewGenerator_) { | |
369 this.previewGenerator_.removeEventListeners(); | |
370 } | |
371 this.overlayEl_ = null; | 380 this.overlayEl_ = null; |
372 this.openSystemDialogButton_ = null; | 381 this.openSystemDialogButton_ = null; |
373 }, | 382 }, |
374 | 383 |
375 /** @override */ | 384 /** @override */ |
376 decorateInternal: function() { | 385 decorateInternal: function() { |
377 this.marginControlContainer_.decorate(this.getElement()); | 386 this.marginControlContainer_.decorate(this.getElement()); |
378 this.overlayEl_ = this.getElement().getElementsByClassName( | 387 this.overlayEl_ = this.getElement().getElementsByClassName( |
379 PreviewArea.Classes_.OVERLAY)[0]; | 388 PreviewArea.Classes_.OVERLAY)[0]; |
380 this.openSystemDialogButton_ = this.getElement().getElementsByClassName( | 389 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, | 675 // 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 | 676 // we don't want this to happen as it can cause the margin to stop |
668 // being draggable. | 677 // being draggable. |
669 this.plugin_.style.pointerEvents = isDragging ? 'none' : 'auto'; | 678 this.plugin_.style.pointerEvents = isDragging ? 'none' : 'auto'; |
670 }, | 679 }, |
671 }; | 680 }; |
672 | 681 |
673 // Export | 682 // Export |
674 return {PreviewArea: PreviewArea}; | 683 return {PreviewArea: PreviewArea}; |
675 }); | 684 }); |
OLD | NEW |