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

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

Issue 2687643004: MD Settings: CrOS: Add secondary user banner (Closed)
Patch Set: Rebase Created 3 years, 10 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',
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 * True if the basic page should currently display the reset profile banner. 46 * True if the basic page should currently display the reset profile banner.
47 * @private {boolean} 47 * @private {boolean}
48 */ 48 */
49 showResetProfileBanner_: { 49 showResetProfileBanner_: {
50 type: Boolean, 50 type: Boolean,
51 value: function() { 51 value: function() {
52 return loadTimeData.getBoolean('showResetProfileBanner'); 52 return loadTimeData.getBoolean('showResetProfileBanner');
53 }, 53 },
54 }, 54 },
55 55
56 // <if expr="chromeos">
57 /**
58 * Whether the user is a secondary user. Computed so that it is calculated
59 * correctly after loadTimeData is available.
60 * @private
61 */
62 showSecondaryUserBanner_: {
63 type: Boolean,
64 computed: 'computeShowSecondaryUserBanner_(hasExpandedSection_)',
65 },
66 // </if>
67
56 /** @private {!settings.Route|undefined} */ 68 /** @private {!settings.Route|undefined} */
57 currentRoute_: Object, 69 currentRoute_: Object,
58 }, 70 },
59 71
60 listeners: { 72 listeners: {
61 'subpage-expand': 'onSubpageExpanded_', 73 'subpage-expand': 'onSubpageExpanded_',
62 }, 74 },
63 75
64 /** @override */ 76 /** @override */
65 attached: function() { 77 attached: function() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 query, assert(this.$$('#basicPage'))); 113 query, assert(this.$$('#basicPage')));
102 114
103 if (this.pageVisibility.advancedSettings !== false) { 115 if (this.pageVisibility.advancedSettings !== false) {
104 assert(whenSearchDone === settings.getSearchManager().search( 116 assert(whenSearchDone === settings.getSearchManager().search(
105 query, assert(this.$.advancedPageTemplate.get()))); 117 query, assert(this.$.advancedPageTemplate.get())));
106 } 118 }
107 119
108 return whenSearchDone; 120 return whenSearchDone;
109 }, 121 },
110 122
123 // <if expr="chromeos">
124 /**
125 * @return {boolean}
126 * @private
127 */
128 computeShowSecondaryUserBanner_: function() {
129 return !this.hasExpandedSection_ &&
130 loadTimeData.getBoolean('isSecondaryUser');
131 },
132 // </if>
133
111 /** @private */ 134 /** @private */
112 onResetDone_: function() { 135 onResetDone_: function() {
113 this.showResetProfileBanner_ = false; 136 this.showResetProfileBanner_ = false;
114 }, 137 },
115 138
116 /** 139 /**
117 * @return {boolean} 140 * @return {boolean}
118 * @private 141 * @private
119 */ 142 */
120 shouldShowAndroidApps_: function() { 143 shouldShowAndroidApps_: function() {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 187
165 /** 188 /**
166 * @param {!settings.Route} currentRoute 189 * @param {!settings.Route} currentRoute
167 * @param {boolean} inSearchMode 190 * @param {boolean} inSearchMode
168 * @param {boolean} hasExpandedSection 191 * @param {boolean} hasExpandedSection
169 * @param {boolean} advancedToggleExpanded 192 * @param {boolean} advancedToggleExpanded
170 * @return {boolean} Whether to show the advanced page, taking into account 193 * @return {boolean} Whether to show the advanced page, taking into account
171 * both routing and search state. 194 * both routing and search state.
172 * @private 195 * @private
173 */ 196 */
174 showAdvancedPage_: function(currentRoute, inSearchMode, hasExpandedSection, 197 showAdvancedPage_: function(
175 advancedToggleExpanded) { 198 currentRoute, inSearchMode, hasExpandedSection, advancedToggleExpanded) {
176 return hasExpandedSection ? 199 return hasExpandedSection ?
177 settings.Route.ADVANCED.contains(currentRoute) : 200 settings.Route.ADVANCED.contains(currentRoute) :
178 advancedToggleExpanded || inSearchMode; 201 advancedToggleExpanded || inSearchMode;
179 }, 202 },
180 203
181 /** 204 /**
182 * @param {(boolean|undefined)} visibility 205 * @param {(boolean|undefined)} visibility
183 * @return {boolean} True unless visibility is false. 206 * @return {boolean} True unless visibility is false.
184 * @private 207 * @private
185 */ 208 */
186 showAdvancedSettings_: function(visibility) { 209 showAdvancedSettings_: function(visibility) {
187 return visibility !== false; 210 return visibility !== false;
188 }, 211 },
189 212
190 /** 213 /**
191 * @param {boolean} opened Whether the menu is expanded. 214 * @param {boolean} opened Whether the menu is expanded.
192 * @return {string} Icon name. 215 * @return {string} Icon name.
193 * @private 216 * @private
194 */ 217 */
195 getArrowIcon_: function(opened) { 218 getArrowIcon_: function(opened) {
196 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; 219 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down';
197 }, 220 },
198 }); 221 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698