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

Side by Side Diff: chrome/browser/resources/settings/settings_menu/settings_menu.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 + took out cr_element parts 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-menu' shows a menu with a hardcoded set of pages and subpages. 7 * 'settings-menu' shows a menu with a hardcoded set of pages and subpages.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-menu', 10 is: 'settings-menu',
11 11
12 properties: { 12 properties: {
13 /** @private */ 13 /** @private */
14 advancedOpened_: Boolean, 14 advancedOpened_: Boolean,
15 15
16 /** 16 /**
17 * The current active route. 17 * The current active route.
18 * @type {!SettingsRoute} 18 * @type {!SettingsRoute}
19 */ 19 */
20 currentRoute: { 20 currentRoute: {
21 type: Object, 21 type: Object,
22 notify: true, 22 notify: true,
23 observer: 'currentRouteChanged_', 23 observer: 'currentRouteChanged_',
24 }, 24 },
25
26 /**
27 * Dictionary defining page visibility.
28 */
29 pageVisibility: {
dpapad 2016/07/21 18:33:33 This needs an @type annotation (here and elsewhere
Moe 2016/07/22 16:59:56 according to michaelpg@ type is unnecessary IF we
30 type: Object,
31 },
25 }, 32 },
26 33
27 attached: function() { 34 attached: function() {
28 document.addEventListener('toggle-advanced-page', function(e) { 35 document.addEventListener('toggle-advanced-page', function(e) {
29 if (e.detail) 36 if (e.detail)
30 this.$.advancedPage.open(); 37 this.$.advancedPage.open();
31 else 38 else
32 this.$.advancedPage.close(); 39 this.$.advancedPage.close();
33 }.bind(this)); 40 }.bind(this));
34 41
35 this.$.advancedPage.addEventListener('paper-submenu-open', function() { 42 this.$.advancedPage.addEventListener('paper-submenu-open', function() {
36 this.fire('toggle-advanced-page', true); 43 this.fire('toggle-advanced-page', true);
37 }.bind(this)); 44 }.bind(this));
38 45
39 this.$.advancedPage.addEventListener('paper-submenu-close', function() { 46 this.$.advancedPage.addEventListener('paper-submenu-close', function() {
40 this.fire('toggle-advanced-page', false); 47 this.fire('toggle-advanced-page', false);
41 }.bind(this)); 48 }.bind(this));
42 49
43 this.fire('toggle-advanced-page', this.currentRoute.page == 'advanced'); 50 this.fire('toggle-advanced-page', this.currentRoute.page == 'advanced');
44 }, 51 },
45 52
46 /** 53 /**
47 * @param {!SettingsRoute} newRoute 54 * @param {!SettingsRoute} newRoute
48 * @private 55 * @private
49 */ 56 */
50 currentRouteChanged_: function(newRoute) { 57 currentRouteChanged_: function(newRoute) {
51 // Sync URL changes to the side nav menu. 58 // Sync URL changes to the side nav menu.
52 59
53 if (newRoute.page == 'advanced') { 60 if (newRoute.page == 'advanced') {
61 var pageVisibility = /** @type {{hideAdvancedSettings: boolean}} */
62 (this.pageVisibility);
63 assert(!pageVisibility.hideAdvancedSettings);
54 this.$.advancedMenu.selected = this.currentRoute.section; 64 this.$.advancedMenu.selected = this.currentRoute.section;
55 this.$.basicMenu.selected = null; 65 this.$.basicMenu.selected = null;
56 } else if (newRoute.page == 'basic') { 66 } else if (newRoute.page == 'basic') {
57 this.$.advancedMenu.selected = null; 67 this.$.advancedMenu.selected = null;
58 this.$.basicMenu.selected = this.currentRoute.section; 68 this.$.basicMenu.selected = this.currentRoute.section;
59 } else { 69 } else {
60 this.$.advancedMenu.selected = null; 70 this.$.advancedMenu.selected = null;
61 this.$.basicMenu.selected = null; 71 this.$.basicMenu.selected = null;
62 } 72 }
63 }, 73 },
(...skipping 30 matching lines...) Expand all
94 104
95 /** 105 /**
96 * @param {boolean} opened Whether the menu is expanded. 106 * @param {boolean} opened Whether the menu is expanded.
97 * @return {string} Which icon to use. 107 * @return {string} Which icon to use.
98 * @private 108 * @private
99 * */ 109 * */
100 arrowState_: function(opened) { 110 arrowState_: function(opened) {
101 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; 111 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down';
102 }, 112 },
103 }); 113 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698