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

Side by Side Diff: chrome/browser/resources/settings/basic_page/basic_page.js

Issue 2852433003: MD Settings: Elim SettingsSubpageBrowsertest and SettingsPageVisibility (Closed)
Patch Set: Rebase + fix settings_main_test.js Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-basic-page' is the settings page containing the actual settings. 7 * 'settings-basic-page' is the settings page containing the actual settings.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-basic-page', 10 is: 'settings-basic-page',
11 11
12 behaviors: [SettingsPageVisibility, MainPageBehavior], 12 behaviors: [MainPageBehavior],
13 13
14 properties: { 14 properties: {
15 /** Preferences state. */ 15 /** Preferences state. */
16 prefs: { 16 prefs: {
17 type: Object, 17 type: Object,
18 notify: true, 18 notify: true,
19 }, 19 },
20 20
21 showAndroidApps: Boolean,
22
23 /** 21 /**
24 * Dictionary defining page visibility. 22 * Dictionary defining page visibility. Controlled by settings-ui.
25 * @type {!GuestModePageVisibility} 23 * @type {!PageVisibility|undefined}
26 */ 24 */
27 pageVisibility: Object, 25 pageVisibility: Object,
28 26
29 advancedToggleExpanded: { 27 advancedToggleExpanded: {
30 type: Boolean, 28 type: Boolean,
31 notify: true, 29 notify: true,
32 observer: 'advancedToggleExpandedChanged_', 30 observer: 'advancedToggleExpandedChanged_',
33 }, 31 },
34 32
35 /** 33 /**
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 didFindMatches: requests.every(function(r) { 125 didFindMatches: requests.every(function(r) {
128 return !r.didFindMatches(); 126 return !r.didFindMatches();
129 }), 127 }),
130 // All requests correspond to the same user query, so only need to check 128 // All requests correspond to the same user query, so only need to check
131 // one of them. 129 // one of them.
132 wasClearSearch: requests[0].isSame(''), 130 wasClearSearch: requests[0].isSame(''),
133 }; 131 };
134 }); 132 });
135 }, 133 },
136 134
135 /**
136 * @param {boolean|undefined} visibility
137 * @return {boolean}
138 * @private
139 */
140 showPage_: function(visibility) {
141 return visibility !== false;
142 },
143
144 /**
145 * @param {string} subpage
146 * @return {!Object}
147 */
148 getPageVisibility_: function(subpage) {
149 return /** @type {Object} */ (this.get(subpage, this.pageVisibility)) || {};
150 },
151
137 // <if expr="chromeos"> 152 // <if expr="chromeos">
138 /** 153 /**
139 * @return {boolean} 154 * @return {boolean}
140 * @private 155 * @private
141 */ 156 */
142 computeShowSecondaryUserBanner_: function() { 157 computeShowSecondaryUserBanner_: function() {
143 return !this.hasExpandedSection_ && 158 return !this.hasExpandedSection_ &&
144 loadTimeData.getBoolean('isSecondaryUser'); 159 loadTimeData.getBoolean('isSecondaryUser');
145 }, 160 },
146 // </if> 161 // </if>
147 162
148 /** @private */ 163 /** @private */
149 onResetProfileBannerClosed_: function() { 164 onResetProfileBannerClosed_: function() {
150 this.showResetProfileBanner_ = false; 165 this.showResetProfileBanner_ = false;
151 }, 166 },
152 167
153 /** 168 /**
154 * @return {boolean}
155 * @private
156 */
157 shouldShowAndroidApps_: function() {
158 var visibility = /** @type {boolean|undefined} */ (
159 this.get('pageVisibility.androidApps'));
160 return this.showAndroidApps && this.showPage(visibility);
161 },
162
163 /**
164 * Hides everything but the newly expanded subpage. 169 * Hides everything but the newly expanded subpage.
165 * @private 170 * @private
166 */ 171 */
167 onSubpageExpanded_: function() { 172 onSubpageExpanded_: function() {
168 this.hasExpandedSection_ = true; 173 this.hasExpandedSection_ = true;
169 }, 174 },
170 175
171 /** 176 /**
172 * Render the advanced page now (don't wait for idle). 177 * Render the advanced page now (don't wait for idle).
173 * @private 178 * @private
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 * @private 217 * @private
213 */ 218 */
214 showAdvancedPage_: function( 219 showAdvancedPage_: function(
215 currentRoute, inSearchMode, hasExpandedSection, advancedToggleExpanded) { 220 currentRoute, inSearchMode, hasExpandedSection, advancedToggleExpanded) {
216 return hasExpandedSection ? 221 return hasExpandedSection ?
217 settings.Route.ADVANCED.contains(currentRoute) : 222 settings.Route.ADVANCED.contains(currentRoute) :
218 advancedToggleExpanded || inSearchMode; 223 advancedToggleExpanded || inSearchMode;
219 }, 224 },
220 225
221 /** 226 /**
222 * @param {(boolean|undefined)} visibility
223 * @return {boolean} True unless visibility is false.
224 * @private
225 */
226 showAdvancedSettings_: function(visibility) {
227 return visibility !== false;
228 },
229
230 /**
231 * @param {boolean} opened Whether the menu is expanded. 227 * @param {boolean} opened Whether the menu is expanded.
232 * @return {string} Icon name. 228 * @return {string} Icon name.
233 * @private 229 * @private
234 */ 230 */
235 getArrowIcon_: function(opened) { 231 getArrowIcon_: function(opened) {
236 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; 232 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down';
237 }, 233 },
238 }); 234 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698