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

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

Issue 2855253003: MD Settings: Eliminate SettingsSubpageBrowsertest. (Closed)
Patch Set: Resolve conflicts. 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, 21 showAndroidApps: Boolean,
22 22
23 /** 23 /**
24 * Dictionary defining page visibility. 24 * Dictionary defining page visibility.
25 * @type {!GuestModePageVisibility} 25 * @type {!GuestModePageVisibility}
26 */ 26 */
27 pageVisibility: Object, 27 pageVisibility: {
28 type: Object,
29 value: function() { return {}; },
30 },
28 31
29 advancedToggleExpanded: { 32 advancedToggleExpanded: {
30 type: Boolean, 33 type: Boolean,
31 notify: true, 34 notify: true,
32 observer: 'advancedToggleExpandedChanged_', 35 observer: 'advancedToggleExpandedChanged_',
33 }, 36 },
34 37
35 /** 38 /**
36 * True if a section is fully expanded to hide other sections beneath it. 39 * True if a section is fully expanded to hide other sections beneath it.
37 * False otherwise (even while animating a section open/closed). 40 * False otherwise (even while animating a section open/closed).
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (!newRoute.isSubpage() || newRoute.section != oldRoute.section) 98 if (!newRoute.isSubpage() || newRoute.section != oldRoute.section)
96 this.hasExpandedSection_ = false; 99 this.hasExpandedSection_ = false;
97 } else { 100 } else {
98 assert(!this.hasExpandedSection_); 101 assert(!this.hasExpandedSection_);
99 } 102 }
100 103
101 MainPageBehaviorImpl.currentRouteChanged.call(this, newRoute, oldRoute); 104 MainPageBehaviorImpl.currentRouteChanged.call(this, newRoute, oldRoute);
102 }, 105 },
103 106
104 /** 107 /**
108 * @param {boolean|undefined} visibility
109 * @return {boolean}
110 * @private
111 */
112 showPage_: function(visibility) {
113 return visibility !== false;
114 },
115
116 /**
105 * Queues a task to search the basic sections, then another for the advanced 117 * Queues a task to search the basic sections, then another for the advanced
106 * sections. 118 * sections.
107 * @param {string} query The text to search for. 119 * @param {string} query The text to search for.
108 * @return {!Promise<!settings.SearchResult>} A signal indicating that 120 * @return {!Promise<!settings.SearchResult>} A signal indicating that
109 * searching finished. 121 * searching finished.
110 */ 122 */
111 searchContents: function(query) { 123 searchContents: function(query) {
112 var whenSearchDone = [ 124 var whenSearchDone = [
113 settings.getSearchManager().search(query, assert(this.$$('#basicPage'))), 125 settings.getSearchManager().search(query, assert(this.$$('#basicPage'))),
114 ]; 126 ];
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 this.showResetProfileBanner_ = false; 162 this.showResetProfileBanner_ = false;
151 }, 163 },
152 164
153 /** 165 /**
154 * @return {boolean} 166 * @return {boolean}
155 * @private 167 * @private
156 */ 168 */
157 shouldShowAndroidApps_: function() { 169 shouldShowAndroidApps_: function() {
158 var visibility = /** @type {boolean|undefined} */ ( 170 var visibility = /** @type {boolean|undefined} */ (
159 this.get('pageVisibility.androidApps')); 171 this.get('pageVisibility.androidApps'));
160 return this.showAndroidApps && this.showPage(visibility); 172 return this.showAndroidApps && this.showPage_(visibility);
161 }, 173 },
162 174
163 /** 175 /**
164 * Hides everything but the newly expanded subpage. 176 * Hides everything but the newly expanded subpage.
165 * @private 177 * @private
166 */ 178 */
167 onSubpageExpanded_: function() { 179 onSubpageExpanded_: function() {
168 this.hasExpandedSection_ = true; 180 this.hasExpandedSection_ = true;
169 }, 181 },
170 182
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 241
230 /** 242 /**
231 * @param {boolean} opened Whether the menu is expanded. 243 * @param {boolean} opened Whether the menu is expanded.
232 * @return {string} Icon name. 244 * @return {string} Icon name.
233 * @private 245 * @private
234 */ 246 */
235 getArrowIcon_: function(opened) { 247 getArrowIcon_: function(opened) {
236 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; 248 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down';
237 }, 249 },
238 }); 250 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698