Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(964)

Side by Side Diff: chrome/browser/resources/print_preview/header_footer_settings.js

Issue 9699040: PrintPreview: Hide/Show the header footer option based on print frame margins. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 HeaderFooterSettings object. This object encapsulates all 9 * Creates a HeaderFooterSettings object. This object encapsulates all
10 * settings and logic related to the headers and footers checkbox. 10 * settings and logic related to the headers and footers checkbox.
(...skipping 15 matching lines...) Expand all
26 */ 26 */
27 get headerFooterCheckbox() { 27 get headerFooterCheckbox() {
28 return this.headerFooterCheckbox_; 28 return this.headerFooterCheckbox_;
29 }, 29 },
30 30
31 /** 31 /**
32 * Checks whether the Headers and Footers checkbox is checked or not. 32 * Checks whether the Headers and Footers checkbox is checked or not.
33 * @return {boolean} true if Headers and Footers are checked. 33 * @return {boolean} true if Headers and Footers are checked.
34 */ 34 */
35 hasHeaderFooter: function() { 35 hasHeaderFooter: function() {
36 return this.headerFooterApplies_ && this.headerFooterCheckbox_.checked; 36 return previewModifiable && this.headerFooterCheckbox_.checked;
37 }, 37 },
38 38
39 /** 39 /**
40 * Sets the state of the headers footers checkbox. 40 * Sets the state of the headers footers checkbox.
41 * @param {boolean} checked True if the headers footers checkbox shoule be 41 * @param {boolean} checked True if the headers footers checkbox shoule be
42 * checked, false if not. 42 * checked, false if not.
43 */ 43 */
44 setChecked: function(checked) { 44 setChecked: function(checked) {
45 this.headerFooterCheckbox_.checked = checked; 45 this.headerFooterCheckbox_.checked = checked;
46 }, 46 },
47 47
48 /** 48 /**
49 * Adding listeners to header footer related controls. 49 * Adding listeners to header footer related controls.
50 * @private 50 * @private
51 */ 51 */
52 addEventListeners_: function() { 52 addEventListeners_: function() {
53 this.headerFooterCheckbox_.onclick = 53 this.headerFooterCheckbox_.onclick =
54 this.onHeaderFooterChanged_.bind(this); 54 this.onHeaderFooterChanged_.bind(this);
55 document.addEventListener(customEvents.PDF_LOADED, 55 document.addEventListener(customEvents.PDF_LOADED,
56 this.onPDFLoaded_.bind(this)); 56 this.onPDFLoaded_.bind(this));
57 document.addEventListener(customEvents.MARGINS_SELECTION_CHANGED,
kmadhusu 2012/03/14 22:10:14 This event is no longer required. So removed the c
58 this.onMarginsSelectionChanged_.bind(this));
59 }, 57 },
60 58
61 onMarginsSelectionChanged_: function(event) { 59 /**
62 this.headerFooterApplies_ = event.selectedMargins != 60 * Sets the visibility of header footer option.
dpapad 2012/03/14 21:15:17 Can you explain what happens now when NO_MARGINS i
kmadhusu 2012/03/14 22:10:14 Yes. It is handled on C++ side. When NO_MARGINS is
63 print_preview.MarginSettings.MARGINS_VALUE_NO_MARGINS; 61 * @param {boolean} headerFooterApplies True if the headers footers
62 * checkbox shoud be hidden, else false.
63 */
64 setVisibility: function(headerFooterApplies) {
65 this.headerFooterApplies_ = headerFooterApplies;
dpapad 2012/03/14 21:15:17 This member variable seems to only be used here. C
kmadhusu 2012/03/14 22:10:14 oops... Fixed. Removed the member variable.
64 this.setVisible_(this.headerFooterApplies_); 66 this.setVisible_(this.headerFooterApplies_);
65 }, 67 },
66 68
67 /** 69 /**
68 * Listener executing when the user selects or de-selects the headers 70 * Listener executing when the user selects or de-selects the headers
69 * and footers option. 71 * and footers option.
70 * @private 72 * @private
71 */ 73 */
72 onHeaderFooterChanged_: function() { 74 onHeaderFooterChanged_: function() {
73 requestPrintPreview(); 75 requestPrintPreview();
(...skipping 19 matching lines...) Expand all
93 fadeInOption(this.headerFooterOption_); 95 fadeInOption(this.headerFooterOption_);
94 else 96 else
95 fadeOutOption(this.headerFooterOption_); 97 fadeOutOption(this.headerFooterOption_);
96 } 98 }
97 }; 99 };
98 100
99 return { 101 return {
100 HeaderFooterSettings: HeaderFooterSettings 102 HeaderFooterSettings: HeaderFooterSettings
101 }; 103 };
102 }); 104 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698