OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 Margins object that holds four margin values. The units in which | 9 * Creates a Margins object that holds four margin values. The units in which |
10 * the values are expressed can be any numeric value. | 10 * the values are expressed can be any numeric value. |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 * Executes when user selects a different margin option, ie, | 555 * Executes when user selects a different margin option, ie, |
556 * |this.marginList_.selectedIndex| is changed. | 556 * |this.marginList_.selectedIndex| is changed. |
557 * @private | 557 * @private |
558 */ | 558 */ |
559 onMarginsChanged_: function() { | 559 onMarginsChanged_: function() { |
560 if (this.isDefaultMarginsSelected() || this.isMinimumMarginsSelected() || | 560 if (this.isDefaultMarginsSelected() || this.isMinimumMarginsSelected() || |
561 this.isNoMarginsSelected()) | 561 this.isNoMarginsSelected()) |
562 this.onDefaultMinimumNoMarginsSelected_(); | 562 this.onDefaultMinimumNoMarginsSelected_(); |
563 else if (this.isCustomMarginsSelected()) | 563 else if (this.isCustomMarginsSelected()) |
564 this.onCustomMarginsSelected_(); | 564 this.onCustomMarginsSelected_(); |
| 565 |
| 566 var customEvent = cr.Event(customEvents.MARGINS_SELECTION_CHANGED); |
| 567 customEvent.selectedMargins = this.selectedMarginsValue; |
| 568 document.dispatchEvent(customEvent); |
565 }, | 569 }, |
566 | 570 |
567 /** | 571 /** |
568 * Executes when the default or minimum or no margins option is selected. | 572 * Executes when the default or minimum or no margins option is selected. |
569 * @private | 573 * @private |
570 */ | 574 */ |
571 onDefaultMinimumNoMarginsSelected_: function() { | 575 onDefaultMinimumNoMarginsSelected_: function() { |
572 this.removeCustomMarginEventListeners_(); | 576 this.removeCustomMarginEventListeners_(); |
573 this.forceDisplayingMarginLines_ = true; | 577 this.forceDisplayingMarginLines_ = true; |
574 this.previousCustomMargins_ = null; | 578 this.previousCustomMargins_ = null; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 this.pageWidth_ = this.currentDefaultPageLayout.pageWidth; | 693 this.pageWidth_ = this.currentDefaultPageLayout.pageWidth; |
690 this.pageHeight_ = this.currentDefaultPageLayout.pageHeight; | 694 this.pageHeight_ = this.currentDefaultPageLayout.pageHeight; |
691 } | 695 } |
692 }; | 696 }; |
693 | 697 |
694 return { | 698 return { |
695 MarginSettings: MarginSettings, | 699 MarginSettings: MarginSettings, |
696 PageLayout: PageLayout, | 700 PageLayout: PageLayout, |
697 }; | 701 }; |
698 }); | 702 }); |
OLD | NEW |