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

Unified Diff: chrome/browser/resources/settings/settings_main/settings_main.js

Issue 2160713002: MD Settings: refactor some main page properties, fix Advanced toggle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/settings/settings_main/settings_main.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/settings_main/settings_main.js
diff --git a/chrome/browser/resources/settings/settings_main/settings_main.js b/chrome/browser/resources/settings/settings_main/settings_main.js
index a5a6d10c5c551c74e652076ad17224e1cae42f98..3fd909a7b4cea708944036d56deb48b72edf93d0 100644
--- a/chrome/browser/resources/settings/settings_main/settings_main.js
+++ b/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -10,12 +10,6 @@ Polymer({
is: 'settings-main',
properties: {
- /** @private */
- isAdvancedMenuOpen_: {
- type: Boolean,
- value: false,
- },
-
/**
* Preferences state.
*/
@@ -35,28 +29,22 @@ Polymer({
},
/** @private */
- showAdvancedPage_: {
+ advancedToggleExpanded_: {
type: Boolean,
value: false,
},
/** @private */
- showAdvancedToggle_: {
- type: Boolean,
- value: true,
- },
+ inSubpage_: Boolean,
/** @private */
- showBasicPage_: {
- type: Boolean,
- value: true,
- },
+ showAboutPage_: Boolean,
/** @private */
- showAboutPage_: {
- type: Boolean,
- value: false,
- },
+ showBasicPage_: Boolean,
+
+ /** @private */
+ showAdvancedPage_: Boolean,
toolbarSpinnerActive: {
type: Boolean,
@@ -82,14 +70,13 @@ Polymer({
/** @override */
attached: function() {
document.addEventListener('toggle-advanced-page', function(e) {
- this.showAdvancedPage_ = e.detail;
- this.isAdvancedMenuOpen_ = e.detail;
+ this.advancedToggleExpanded_ = e.detail;
this.currentRoute = {
- page: this.isAdvancedMenuOpen_ ? 'advanced' : 'basic',
+ page: this.advancedToggleExpanded_ ? 'advanced' : 'basic',
section: '',
subpage: [],
};
- if (this.showAdvancedPage_) {
+ if (this.advancedToggleExpanded_) {
doWhenReady(
function() {
var advancedPage = this.$$('settings-advanced-page');
@@ -115,7 +102,7 @@ Polymer({
* @param {boolean} opened Whether the menu is expanded.
* @return {string} Which icon to use.
* @private
- * */
+ */
arrowState_: function(opened) {
return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down';
},
@@ -125,24 +112,26 @@ Polymer({
* @private
*/
currentRouteChanged_: function(newRoute) {
- var isSubpage = !!newRoute.subpage.length;
-
+ this.inSubpage_ = newRoute.subpage.length > 0;
this.showAboutPage_ = newRoute.page == 'about';
dpapad 2016/07/20 21:30:08 Drive-by question: Would it make more sense to pac
michaelpg 2016/07/20 22:25:39 Fine idea, done.
+ if (this.showAboutPage_) {
+ this.showBasicPage_ = this.showAdvancedPage_ = false;
+ } else if (newRoute.page == 'basic') {
+ this.showBasicPage_ = true;
+ this.showAdvancedPage_ = !this.inSubpage_ && this.advancedToggleExpanded_;
+ } else if (newRoute.page == 'advanced') {
+ this.showBasicPage_ = !this.inSubpage_;
+ this.showAdvancedPage_ = this.advancedToggleExpanded_ = true;
+ } else {
+ assertNotReached('Invalid page ' + newRoute.page);
+ }
- this.showAdvancedToggle_ = !this.showAboutPage_ && !isSubpage;
-
- this.showBasicPage_ = this.showAdvancedToggle_ || newRoute.page == 'basic';
-
- this.showAdvancedPage_ =
- (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) ||
- newRoute.page == 'advanced';
-
- this.style.height = isSubpage ? '100%' : '';
+ this.style.height = this.inSubpage_ ? '100%' : '';
},
/** @private */
toggleAdvancedPage_: function() {
- this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_);
+ this.fire('toggle-advanced-page', !this.advancedToggleExpanded_);
},
/**
« no previous file with comments | « chrome/browser/resources/settings/settings_main/settings_main.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698