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

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

Issue 2008843003: [MD settings] redesign of side nav (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review changes Created 4 years, 6 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 *
9 * Example:
10 *
11 * <settings-main pages="[[pages]]" selected-page-id="{{selectedId}}">
12 * </settings-main>
13 *
14 * See settings-drawer for example of use in 'paper-drawer-panel'.
15 */ 8 */
16 Polymer({ 9 Polymer({
17 is: 'settings-main', 10 is: 'settings-main',
18 11
19 properties: { 12 properties: {
13 /** @private */
14 isAdvancedMenuOpen_: Boolean,
15
20 /** 16 /**
21 * Preferences state. 17 * Preferences state.
22 *
23 * @type {?CrSettingsPrefsElement}
24 */ 18 */
25 prefs: { 19 prefs: {
26 type: Object, 20 type: Object,
27 notify: true, 21 notify: true,
28 }, 22 },
29 23
30 /** 24 /**
31 * The current active route. 25 * The current active route.
26 * @type {!SettingsRoute}
32 */ 27 */
33 currentRoute: { 28 currentRoute: {
34 type: Object, 29 type: Object,
35 notify: true, 30 notify: true,
36 observer: 'currentRouteChanged_', 31 observer: 'currentRouteChanged_',
37 }, 32 },
38 33
39 /** @private */ 34 /** @private */
40 showAdvancedPage_: Boolean, 35 showAdvancedPage_: Boolean,
41 36
42 /** @private */ 37 /** @private */
38 showAdvancedToggle_: Boolean,
Dan Beam 2016/06/06 22:31:03 showAdvancedToggle_: { type: Boolean, value: u
dschuyler 2016/06/06 23:05:13 Done.
39
40 /** @private */
43 showBasicPage_: Boolean, 41 showBasicPage_: Boolean,
Dan Beam 2016/06/06 22:31:03 make true by default? or undefined?
dschuyler 2016/06/06 23:05:13 Done.
44 42
45 /** @private */ 43 /** @private */
46 showAboutPage_: Boolean, 44 showAboutPage_: Boolean,
47 }, 45 },
48 46
47 attached: function() {
48 document.addEventListener('toggle-advanced-page', function(e) {
49 this.showAdvancedPage_ = e.detail;
50 this.isAdvancedMenuOpen_ = e.detail;
51 }.bind(this));
52 },
53
49 /** 54 /**
50 * @param {!SettingsRoute} newRoute 55 * @param {!SettingsRoute} newRoute
51 * @private 56 * @private
52 */ 57 */
53 currentRouteChanged_: function(newRoute) { 58 currentRouteChanged_: function(newRoute) {
Dan Beam 2016/06/03 03:12:24 does this get called immediately after load or som
dschuyler 2016/06/06 21:47:55 I believe so. I don't know of a case where it does
59 var isSubpage = !!newRoute.subpage.length;
60
54 this.showAboutPage_ = newRoute.page == 'about'; 61 this.showAboutPage_ = newRoute.page == 'about';
55 this.showAdvancedPage_ = newRoute.page == 'advanced'; 62
56 this.showBasicPage_ = newRoute.page == 'basic'; 63 this.showAdvancedToggle_ = !this.showAboutPage_ && !isSubpage;
64
65 this.showBasicPage_ = this.showAdvancedToggle_ || newRoute.page == 'basic';
66
67 this.showAdvancedPage_ =
68 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) ||
69 newRoute.page == 'advanced';
70
71 this.$.pageContainer.style.height = isSubpage ? '100%' : '';
72 },
73
74 /** @private */
75 toggleAdvancedPage_: function() {
76 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_);
57 }, 77 },
58 }); 78 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698