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

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

Issue 2106103006: MD Settings: cr/cros - Guest mode page visibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments + bug fix Created 4 years, 5 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-main' displays the selected settings page. 7 * 'settings-main' displays the selected settings page.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-main', 10 is: 'settings-main',
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 showAboutPage_: { 56 showAboutPage_: {
57 type: Boolean, 57 type: Boolean,
58 value: false, 58 value: false,
59 }, 59 },
60 60
61 toolbarSpinnerActive: { 61 toolbarSpinnerActive: {
62 type: Boolean, 62 type: Boolean,
63 value: false, 63 value: false,
64 notify: true, 64 notify: true,
65 }, 65 },
66
67 /**
68 * Dictionary defining page visibility.
69 * @type {!GuestModePageVisibility}
70 */
71 pageVisibility: {
72 type: Object,
73 value: function() { return {}; },
Moe 2016/07/22 16:59:56 michaelpg@, I had to bring this back b/c dom-if do
74 },
66 }, 75 },
67 76
68 /** @override */ 77 /** @override */
69 created: function() { 78 created: function() {
70 /** @private {!PromiseResolver} */ 79 /** @private {!PromiseResolver} */
71 this.resolver_ = new PromiseResolver; 80 this.resolver_ = new PromiseResolver;
72 settings.main.rendered = this.resolver_.promise; 81 settings.main.rendered = this.resolver_.promise;
73 }, 82 },
74 83
75 /** @override */ 84 /** @override */
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 */ 125 */
117 currentRouteChanged_: function(newRoute) { 126 currentRouteChanged_: function(newRoute) {
118 var isSubpage = !!newRoute.subpage.length; 127 var isSubpage = !!newRoute.subpage.length;
119 128
120 this.showAboutPage_ = newRoute.page == 'about'; 129 this.showAboutPage_ = newRoute.page == 'about';
121 130
122 this.showAdvancedToggle_ = !this.showAboutPage_ && !isSubpage; 131 this.showAdvancedToggle_ = !this.showAboutPage_ && !isSubpage;
123 132
124 this.showBasicPage_ = this.showAdvancedToggle_ || newRoute.page == 'basic'; 133 this.showBasicPage_ = this.showAdvancedToggle_ || newRoute.page == 'basic';
125 134
135 if (newRoute.page == 'advanced') {
136 assert(this.showAdvancedSettings(this.pageVisibility.advancedSettings));
137 }
138
126 this.showAdvancedPage_ = 139 this.showAdvancedPage_ =
127 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) || 140 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) ||
128 newRoute.page == 'advanced'; 141 newRoute.page == 'advanced';
129 142
130 this.style.height = isSubpage ? '100%' : ''; 143 this.style.height = isSubpage ? '100%' : '';
131 }, 144 },
132 145
133 /** @private */ 146 /** @private */
134 toggleAdvancedPage_: function() { 147 toggleAdvancedPage_: function() {
135 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); 148 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_);
(...skipping 25 matching lines...) Expand all
161 settings.getSearchManager().search( 174 settings.getSearchManager().search(
162 query, assert(this.$$('settings-basic-page'))); 175 query, assert(this.$$('settings-basic-page')));
163 }.bind(this), 0); 176 }.bind(this), 0);
164 177
165 this.showAdvancedPage_ = true; 178 this.showAdvancedPage_ = true;
166 setTimeout(function() { 179 setTimeout(function() {
167 settings.getSearchManager().search( 180 settings.getSearchManager().search(
168 query, assert(this.$$('settings-advanced-page'))); 181 query, assert(this.$$('settings-advanced-page')));
169 }.bind(this), 0); 182 }.bind(this), 0);
170 }, 183 },
184
185 /**
186 * @param {(boolean|undefined)} visibility
187 * @return {boolean} True unless visibility is false.
188 */
189 showAdvancedSettings: function(visibility) {
190 return visibility !== false;
191 },
171 }); 192 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698