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

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: rebase after overscrollHeight_() fix Created 4 years, 4 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 * @type {!GuestModePageVisibility}
29 */
30 pageVisibility: {
31 type: Object,
32 },
25 }, 33 },
26 34
27 attached: function() { 35 attached: function() {
28 document.addEventListener('toggle-advanced-page', function(e) { 36 document.addEventListener('toggle-advanced-page', function(e) {
29 if (e.detail) 37 if (e.detail)
30 this.$.advancedPage.open(); 38 this.$.advancedPage.open();
31 else 39 else
32 this.$.advancedPage.close(); 40 this.$.advancedPage.close();
33 }.bind(this)); 41 }.bind(this));
34 42
35 this.$.advancedPage.addEventListener('paper-submenu-open', function() { 43 this.$.advancedPage.addEventListener('paper-submenu-open', function() {
36 this.fire('toggle-advanced-page', true); 44 this.fire('toggle-advanced-page', true);
37 }.bind(this)); 45 }.bind(this));
38 46
39 this.$.advancedPage.addEventListener('paper-submenu-close', function() { 47 this.$.advancedPage.addEventListener('paper-submenu-close', function() {
40 this.fire('toggle-advanced-page', false); 48 this.fire('toggle-advanced-page', false);
41 }.bind(this)); 49 }.bind(this));
42 50
43 this.fire('toggle-advanced-page', this.currentRoute.page == 'advanced'); 51 this.fire('toggle-advanced-page', this.currentRoute.page == 'advanced');
44 }, 52 },
45 53
46 /** 54 /**
47 * @param {!SettingsRoute} newRoute 55 * @param {!SettingsRoute} newRoute
48 * @private 56 * @private
49 */ 57 */
50 currentRouteChanged_: function(newRoute) { 58 currentRouteChanged_: function(newRoute) {
51 // Sync URL changes to the side nav menu. 59 // Sync URL changes to the side nav menu.
52 60
53 if (newRoute.page == 'advanced') { 61 if (newRoute.page == 'advanced') {
62 assert(!this.pageVisibility ||
63 this.pageVisibility.advancedSettings !== false);
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