| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 */ | 165 */ |
| 166 this.overlayEl_ = null; | 166 this.overlayEl_ = null; |
| 167 | 167 |
| 168 /** | 168 /** |
| 169 * The "Open system dialog" button. | 169 * The "Open system dialog" button. |
| 170 * @type {HTMLButtonElement} | 170 * @type {HTMLButtonElement} |
| 171 * @private | 171 * @private |
| 172 */ | 172 */ |
| 173 this.openSystemDialogButton_ = null; | 173 this.openSystemDialogButton_ = null; |
| 174 | 174 |
| 175 /** | |
| 176 * If this is in a browser test (fake plugin). | |
| 177 * @private {boolean} | |
| 178 */ | |
| 179 this.isBrowserTest_ = false; | |
| 180 } | 175 } |
| 181 | 176 |
| 182 /** | 177 /** |
| 183 * Event types dispatched by the preview area. | 178 * Event types dispatched by the preview area. |
| 184 * @enum {string} | 179 * @enum {string} |
| 185 */ | 180 */ |
| 186 PreviewArea.EventType = { | 181 PreviewArea.EventType = { |
| 187 // Dispatched when the "Open system dialog" button is clicked. | 182 // Dispatched when the "Open system dialog" button is clicked. |
| 188 OPEN_SYSTEM_DIALOG_CLICK: | 183 OPEN_SYSTEM_DIALOG_CLICK: |
| 189 'print_preview.PreviewArea.OPEN_SYSTEM_DIALOG_CLICK', | 184 'print_preview.PreviewArea.OPEN_SYSTEM_DIALOG_CLICK', |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 this.plugin_.loadPreviewPage(event.previewUrl, event.previewIndex); | 593 this.plugin_.loadPreviewPage(event.previewUrl, event.previewIndex); |
| 599 }, | 594 }, |
| 600 | 595 |
| 601 /** | 596 /** |
| 602 * Called when the preview generation is complete and the document is ready | 597 * Called when the preview generation is complete and the document is ready |
| 603 * to print. | 598 * to print. |
| 604 * @private | 599 * @private |
| 605 */ | 600 */ |
| 606 onDocumentReady_: function(event) { | 601 onDocumentReady_: function(event) { |
| 607 this.isDocumentReady_ = true; | 602 this.isDocumentReady_ = true; |
| 608 if (this.isBrowserTest_) | |
| 609 this.isPluginReloaded_ = true; | |
| 610 this.dispatchPreviewGenerationDoneIfReady_(); | 603 this.dispatchPreviewGenerationDoneIfReady_(); |
| 611 }, | 604 }, |
| 612 | 605 |
| 613 /** | 606 /** |
| 614 * Cancels the timeout so that an error message can be shown. | 607 * Cancels the timeout so that an error message can be shown. |
| 615 */ | 608 */ |
| 616 cancelTimeout: function() { | 609 cancelTimeout: function() { |
| 617 if (this.loadingTimeout_) { | 610 if (this.loadingTimeout_) { |
| 618 clearTimeout(this.loadingTimeout_); | 611 clearTimeout(this.loadingTimeout_); |
| 619 this.loadingTimeout_ = null; | 612 this.loadingTimeout_ = null; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 onMarginDragChanged_: function(isDragging) { | 661 onMarginDragChanged_: function(isDragging) { |
| 669 if (!this.plugin_) | 662 if (!this.plugin_) |
| 670 return; | 663 return; |
| 671 | 664 |
| 672 // When hovering over the plugin (which may be in a separate iframe) | 665 // When hovering over the plugin (which may be in a separate iframe) |
| 673 // pointer events will be sent to the frame. When dragging the margins, | 666 // pointer events will be sent to the frame. When dragging the margins, |
| 674 // we don't want this to happen as it can cause the margin to stop | 667 // we don't want this to happen as it can cause the margin to stop |
| 675 // being draggable. | 668 // being draggable. |
| 676 this.plugin_.style.pointerEvents = isDragging ? 'none' : 'auto'; | 669 this.plugin_.style.pointerEvents = isDragging ? 'none' : 'auto'; |
| 677 }, | 670 }, |
| 678 | |
| 679 /** @param {boolean} isTest Whether this instance is in a browser test. */ | |
| 680 setIsBrowserTest: function(isTest) { | |
| 681 this.isBrowserTest_ = isTest; | |
| 682 } | |
| 683 }; | 671 }; |
| 684 | 672 |
| 685 // Export | 673 // Export |
| 686 return {PreviewArea: PreviewArea}; | 674 return {PreviewArea: PreviewArea}; |
| 687 }); | 675 }); |
| OLD | NEW |