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

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: asdf 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-main' displays the selected settings page. 7 * 'settings-main' displays the selected settings page.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-main', 10 is: 'settings-main',
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 value: true, 52 value: true,
53 }, 53 },
54 54
55 /** @private */ 55 /** @private */
56 showAboutPage_: { 56 showAboutPage_: {
57 type: Boolean, 57 type: Boolean,
58 value: false, 58 value: false,
59 }, 59 },
60 }, 60 },
61 61
62 created: function() {
63 /** @private {!PromiseResolver} */
64 this.resolver_ = new PromiseResolver;
65 settings.main.rendered = this.resolver_.promise;
66 },
67
62 attached: function() { 68 attached: function() {
63 document.addEventListener('toggle-advanced-page', function(e) { 69 document.addEventListener('toggle-advanced-page', function(e) {
64 this.showAdvancedPage_ = e.detail; 70 this.showAdvancedPage_ = e.detail;
65 this.isAdvancedMenuOpen_ = e.detail; 71 this.isAdvancedMenuOpen_ = e.detail;
66 if (this.showAdvancedPage_) { 72 if (this.showAdvancedPage_) {
67 scrollWhenReady( 73 doWhenReady(
68 function() { 74 function() {
69 return this.$$('settings-advanced-page'); 75 var advancedPage = this.$$('settings-advanced-page');
76 return !!advancedPage && advancedPage.scrollHeight > 0;
70 }.bind(this), 77 }.bind(this),
71 function() { 78 function() {
72 return this.$$('#toggleContainer'); 79 this.$$('#toggleContainer').scrollIntoView();
73 }.bind(this)); 80 }.bind(this));
74 } 81 }
75 }.bind(this)); 82 }.bind(this));
83
84 doWhenReady(
85 function() {
86 var basicPage = this.$$('settings-basic-page');
87 return !!basicPage && basicPage.scrollHeight > 0;
88 }.bind(this),
89 function() {
90 this.resolver_.resolve();
91 }.bind(this));
76 }, 92 },
77 93
78 /** 94 /**
79 * @param {boolean} opened Whether the menu is expanded. 95 * @param {boolean} opened Whether the menu is expanded.
80 * @return {string} Which icon to use. 96 * @return {string} Which icon to use.
81 * @private 97 * @private
82 * */ 98 * */
83 arrowState_: function(opened) { 99 arrowState_: function(opened) {
84 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down'; 100 return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down';
85 }, 101 },
(...skipping 16 matching lines...) Expand all
102 newRoute.page == 'advanced'; 118 newRoute.page == 'advanced';
103 119
104 this.style.height = isSubpage ? '100%' : ''; 120 this.style.height = isSubpage ? '100%' : '';
105 }, 121 },
106 122
107 /** @private */ 123 /** @private */
108 toggleAdvancedPage_: function() { 124 toggleAdvancedPage_: function() {
109 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); 125 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_);
110 }, 126 },
111 }); 127 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698