| 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.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Creates a PreviewArea object. It represents the area where the preview | 9 * Creates a PreviewArea object. It represents the area where the preview |
| 10 * document is displayed. | 10 * document is displayed. |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 cr.dispatchSimpleEvent( | 549 cr.dispatchSimpleEvent( |
| 550 this, PreviewArea.EventType.PREVIEW_GENERATION_DONE); | 550 this, PreviewArea.EventType.PREVIEW_GENERATION_DONE); |
| 551 this.marginControlContainer_.showMarginControlsIfNeeded(); | 551 this.marginControlContainer_.showMarginControlsIfNeeded(); |
| 552 } | 552 } |
| 553 }, | 553 }, |
| 554 | 554 |
| 555 /** | 555 /** |
| 556 * Called when the open-system-dialog button is clicked. Disables the | 556 * Called when the open-system-dialog button is clicked. Disables the |
| 557 * button, shows the throbber, and dispatches the OPEN_SYSTEM_DIALOG_CLICK | 557 * button, shows the throbber, and dispatches the OPEN_SYSTEM_DIALOG_CLICK |
| 558 * event. | 558 * event. |
| 559 * @param {number} pageX the x-coordinate of the page relative to the | |
| 560 * screen. | |
| 561 * @param {number} pageY the y-coordinate of the page relative to the | |
| 562 * screen. | |
| 563 * @param {number} pageWidth the width of the page on the screen. | |
| 564 * @param {number} viewportWidth the width of the viewport. | |
| 565 * @param {number} viewportHeight the height of the viewport. | |
| 566 * @private | 559 * @private |
| 567 */ | 560 */ |
| 568 onOpenSystemDialogButtonClick_: function() { | 561 onOpenSystemDialogButtonClick_: function() { |
| 569 this.openSystemDialogButton_.disabled = true; | 562 this.openSystemDialogButton_.disabled = true; |
| 570 var openSystemDialogThrobber = this.getElement().getElementsByClassName( | 563 var openSystemDialogThrobber = this.getElement().getElementsByClassName( |
| 571 PreviewArea.Classes_.OPEN_SYSTEM_DIALOG_BUTTON_THROBBER)[0]; | 564 PreviewArea.Classes_.OPEN_SYSTEM_DIALOG_BUTTON_THROBBER)[0]; |
| 572 setIsVisible(openSystemDialogThrobber, true); | 565 setIsVisible(openSystemDialogThrobber, true); |
| 573 cr.dispatchSimpleEvent( | 566 cr.dispatchSimpleEvent( |
| 574 this, PreviewArea.EventType.OPEN_SYSTEM_DIALOG_CLICK); | 567 this, PreviewArea.EventType.OPEN_SYSTEM_DIALOG_CLICK); |
| 575 }, | 568 }, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 587 this.showMessage_.bind(this, PreviewArea.MessageId_.LOADING), | 580 this.showMessage_.bind(this, PreviewArea.MessageId_.LOADING), |
| 588 PreviewArea.LOADING_TIMEOUT_); | 581 PreviewArea.LOADING_TIMEOUT_); |
| 589 } | 582 } |
| 590 } else { | 583 } else { |
| 591 this.marginControlContainer_.showMarginControlsIfNeeded(); | 584 this.marginControlContainer_.showMarginControlsIfNeeded(); |
| 592 } | 585 } |
| 593 }, | 586 }, |
| 594 | 587 |
| 595 /** | 588 /** |
| 596 * Called when the preview generator begins loading the preview. | 589 * Called when the preview generator begins loading the preview. |
| 597 * @param {Event} Contains the URL to initialize the plugin to. | 590 * @param {Event} event Contains the URL to initialize the plugin to. |
| 598 * @private | 591 * @private |
| 599 */ | 592 */ |
| 600 onPreviewStart_: function(event) { | 593 onPreviewStart_: function(event) { |
| 601 this.isDocumentReady_ = false; | 594 this.isDocumentReady_ = false; |
| 602 this.isPluginReloaded_ = false; | 595 this.isPluginReloaded_ = false; |
| 603 if (!this.plugin_) { | 596 if (!this.plugin_) { |
| 604 this.createPlugin_(event.previewUrl); | 597 this.createPlugin_(event.previewUrl); |
| 605 } else { | 598 } else { |
| 606 if (this.pluginType_ == PreviewArea.PluginType_.OUT_OF_PROCESS) { | 599 if (this.pluginType_ == PreviewArea.PluginType_.OUT_OF_PROCESS) { |
| 607 var grayscale = !this.printTicketStore_.color.getValue(); | 600 var grayscale = !this.printTicketStore_.color.getValue(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 new print_preview.Size(viewportWidth, viewportHeight)); | 734 new print_preview.Size(viewportWidth, viewportHeight)); |
| 742 } | 735 } |
| 743 } | 736 } |
| 744 }; | 737 }; |
| 745 | 738 |
| 746 // Export | 739 // Export |
| 747 return { | 740 return { |
| 748 PreviewArea: PreviewArea | 741 PreviewArea: PreviewArea |
| 749 }; | 742 }; |
| 750 }); | 743 }); |
| OLD | NEW |