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

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

Issue 2094223004: MD Settings: make chrome://[md-]settings/clearBrowserData URL work (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 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 (function() {
6
7 var resolver = new PromiseResolver();
8
5 /** 9 /**
6 * @fileoverview 10 * @fileoverview
7 * 'settings-main' displays the selected settings page. 11 * 'settings-main' displays the selected settings page.
8 */ 12 */
9 Polymer({ 13 Polymer({
10 is: 'settings-main', 14 is: 'settings-main',
11 15
12 properties: { 16 properties: {
13 /** @private */ 17 /** @private */
14 isAdvancedMenuOpen_: { 18 isAdvancedMenuOpen_: {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 type: Boolean, 61 type: Boolean,
58 value: false, 62 value: false,
59 }, 63 },
60 }, 64 },
61 65
62 attached: function() { 66 attached: function() {
63 document.addEventListener('toggle-advanced-page', function(e) { 67 document.addEventListener('toggle-advanced-page', function(e) {
64 this.showAdvancedPage_ = e.detail; 68 this.showAdvancedPage_ = e.detail;
65 this.isAdvancedMenuOpen_ = e.detail; 69 this.isAdvancedMenuOpen_ = e.detail;
66 if (this.showAdvancedPage_) { 70 if (this.showAdvancedPage_) {
67 scrollWhenReady( 71 doWhenReady(
68 function() { 72 function() {
69 return this.$$('settings-advanced-page'); 73 var advancedPage = this.$$('settings-advanced-page');
74 return advancedPage && advancedPage.scrollHeight > 0;
70 }.bind(this), 75 }.bind(this),
71 function() { 76 function() {
72 return this.$$('#toggleContainer'); 77 this.$$('#toggleContainer').scrollIntoView();
73 }.bind(this)); 78 }.bind(this));
74 } 79 }
75 }.bind(this)); 80 }.bind(this));
81
82 doWhenReady(
83 function() {
84 var basicPage = this.$$('settings-basic-page');
85 return basicPage && basicPage.scrollHeight > 0;
86 }.bind(this),
87 function() {
88 resolver.resolve();
89 });
76 }, 90 },
77 91
78 /** 92 /**
79 * @param {boolean} opened Whether the menu is expanded. 93 * @param {boolean} opened Whether the menu is expanded.
80 * @return {string} Which icon to use. 94 * @return {string} Which icon to use.
81 * @private 95 * @private
82 * */ 96 * */
83 arrowState_: function(opened) { 97 arrowState_: function(opened) {
84 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; 98 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down';
85 }, 99 },
86 100
87 /** 101 /**
88 * @param {!SettingsRoute} newRoute 102 * @param {!SettingsRoute} newRoute
89 * @private 103 * @private
90 */ 104 */
91 currentRouteChanged_: function(newRoute) { 105 currentRouteChanged_: function(newRoute) {
92 var isSubpage = !!newRoute.subpage.length; 106 var isSubpage = newRoute.subpage.length > 0 &&
107 newRoute.subpage[0] != 'clear-browsing-data';
93 108
94 this.showAboutPage_ = newRoute.page == 'about'; 109 this.showAboutPage_ = newRoute.page == 'about';
95 110
96 this.showAdvancedToggle_ = !this.showAboutPage_ && !isSubpage; 111 this.showAdvancedToggle_ = !this.showAboutPage_ && !isSubpage;
97 112
98 this.showBasicPage_ = this.showAdvancedToggle_ || newRoute.page == 'basic'; 113 this.showBasicPage_ = this.showAdvancedToggle_ || newRoute.page == 'basic';
99 114
100 this.showAdvancedPage_ = 115 this.showAdvancedPage_ =
101 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) || 116 (this.isAdvancedMenuOpen_ && this.showAdvancedToggle_) ||
102 newRoute.page == 'advanced'; 117 newRoute.page == 'advanced';
103 118
104 this.style.height = isSubpage ? '100%' : ''; 119 this.style.height = isSubpage ? '100%' : '';
105 }, 120 },
106 121
107 /** @private */ 122 /** @private */
108 toggleAdvancedPage_: function() { 123 toggleAdvancedPage_: function() {
109 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); 124 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_);
110 }, 125 },
111 }); 126 });
127
128 cr.define('settings.main', function() {
129 return {rendered: resolver.promise};
130 });
131
132 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698