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

Side by Side Diff: chrome/browser/resources/print_preview/settings/more_settings.js

Issue 588713002: Compile print_preview, part 3: reduce down to 185 errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@I_print_preview_2
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 * Toggles visibility of the specified printing options sections. 9 * Toggles visibility of the specified printing options sections.
10 * @param {!print_preview.DestinationStore} destinationStore To listen for 10 * @param {!print_preview.DestinationStore} destinationStore To listen for
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 }, 102 },
103 103
104 /** 104 /**
105 * Updates the component appearance according to the current state. 105 * Updates the component appearance according to the current state.
106 * @param {boolean} noAnimation Whether section visibility transitions 106 * @param {boolean} noAnimation Whether section visibility transitions
107 * should not be animated. 107 * should not be animated.
108 * @private 108 * @private
109 */ 109 */
110 updateState_: function(noAnimation) { 110 updateState_: function(noAnimation) {
111 if (!this.firstDestinationReady_) { 111 if (!this.firstDestinationReady_) {
112 fadeOutElement(this.getElement(), noAnimation); 112 fadeOutElement(this.getElement());
113 return; 113 return;
114 } 114 }
115 115
116 var all = this.settingsToShow_ == MoreSettings.SettingsToShow.ALL; 116 var all = this.settingsToShow_ == MoreSettings.SettingsToShow.ALL;
117 this.getChildElement('.more-settings-label').textContent = 117 this.getChildElement('.more-settings-label').textContent =
118 localStrings.getString(all ? 'lessOptionsLabel' : 'moreOptionsLabel'); 118 localStrings.getString(all ? 'lessOptionsLabel' : 'moreOptionsLabel');
119 var iconEl = this.getChildElement('.more-settings-icon'); 119 var iconEl = this.getChildElement('.more-settings-icon');
120 iconEl.classList.toggle('more-settings-icon-plus', !all); 120 iconEl.classList.toggle('more-settings-icon-plus', !all);
121 iconEl.classList.toggle('more-settings-icon-minus', all); 121 iconEl.classList.toggle('more-settings-icon-minus', all);
122 122
123 var availableSections = this.settingsSections_.reduce( 123 var availableSections = this.settingsSections_.reduce(
124 function(count, section) { 124 function(count, section) {
125 return count + (section.isAvailable() ? 1 : 0); 125 return count + (section.isAvailable() ? 1 : 0);
126 }, 0); 126 }, 0);
127 127
128 // Magic 6 is chosen as the number of sections when it still feels like 128 // Magic 6 is chosen as the number of sections when it still feels like
129 // manageable and not too crowded. Also, when capabilities are not know 129 // manageable and not too crowded. Also, when capabilities are not know
130 // yet, ignore this limit to avoid unnecessary fade in/out cycles. 130 // yet, ignore this limit to avoid unnecessary fade in/out cycles.
131 var hasSectionsToToggle = 131 var hasSectionsToToggle =
132 (availableSections > 6 || !this.capabilitiesReady_) && 132 (availableSections > 6 || !this.capabilitiesReady_) &&
133 this.settingsSections_.some(function(section) { 133 this.settingsSections_.some(function(section) {
134 return section.hasCollapsibleContent(); 134 return section.hasCollapsibleContent();
135 }); 135 });
136 136
137 if (hasSectionsToToggle) 137 if (hasSectionsToToggle)
138 fadeInElement(this.getElement(), noAnimation); 138 fadeInElement(this.getElement(), noAnimation);
139 else 139 else
140 fadeOutElement(this.getElement(), noAnimation); 140 fadeOutElement(this.getElement());
141 141
142 var collapseContent = 142 var collapseContent =
143 this.settingsToShow_ == MoreSettings.SettingsToShow.MOST_POPULAR && 143 this.settingsToShow_ == MoreSettings.SettingsToShow.MOST_POPULAR &&
144 hasSectionsToToggle; 144 hasSectionsToToggle;
145 this.settingsSections_.forEach(function(section) { 145 this.settingsSections_.forEach(function(section) {
146 section.setCollapseContent(collapseContent, noAnimation); 146 section.setCollapseContent(collapseContent, noAnimation);
147 }); 147 });
148 } 148 }
149 }; 149 };
150 150
151 // Export 151 // Export
152 return { 152 return {
153 MoreSettings: MoreSettings 153 MoreSettings: MoreSettings
154 }; 154 };
155 }); 155 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698