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

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: inb4 h8rs 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 },
(...skipping 16 matching lines...) Expand all
102 newRoute.page == 'advanced'; 116 newRoute.page == 'advanced';
103 117
104 this.style.height = isSubpage ? '100%' : ''; 118 this.style.height = isSubpage ? '100%' : '';
105 }, 119 },
106 120
107 /** @private */ 121 /** @private */
108 toggleAdvancedPage_: function() { 122 toggleAdvancedPage_: function() {
109 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); 123 this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_);
110 }, 124 },
111 }); 125 });
126
127 cr.define('settings.main', function() {
128 return {rendered: resolver.promise};
129 });
130
131 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698