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

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

Issue 2660383002: [MD settings] idle load basic and advanced pages (Closed)
Patch Set: added unit test Created 3 years, 10 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-basic-page' is the settings page containing the actual settings. 7 * 'settings-basic-page' is the settings page containing the actual settings.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-basic-page', 10 is: 'settings-basic-page',
(...skipping 11 matching lines...) Expand all
22 22
23 /** 23 /**
24 * Dictionary defining page visibility. 24 * Dictionary defining page visibility.
25 * @type {!GuestModePageVisibility} 25 * @type {!GuestModePageVisibility}
26 */ 26 */
27 pageVisibility: Object, 27 pageVisibility: Object,
28 28
29 advancedToggleExpanded: { 29 advancedToggleExpanded: {
30 type: Boolean, 30 type: Boolean,
31 notify: true, 31 notify: true,
32 observer: 'advancedToggleExpandedChanged_',
32 }, 33 },
33 34
34 /** 35 /**
35 * True if a section is fully expanded to hide other sections beneath it. 36 * True if a section is fully expanded to hide other sections beneath it.
36 * False otherwise (even while animating a section open/closed). 37 * False otherwise (even while animating a section open/closed).
37 * @private {boolean} 38 * @private {boolean}
38 */ 39 */
39 hasExpandedSection_: { 40 hasExpandedSection_: {
40 type: Boolean, 41 type: Boolean,
41 value: false, 42 value: false,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 * @param {string} query The text to search for. 95 * @param {string} query The text to search for.
95 * @return {!Promise<!settings.SearchRequest>} A signal indicating that 96 * @return {!Promise<!settings.SearchRequest>} A signal indicating that
96 * searching finished. 97 * searching finished.
97 */ 98 */
98 searchContents: function(query) { 99 searchContents: function(query) {
99 var whenSearchDone = settings.getSearchManager().search( 100 var whenSearchDone = settings.getSearchManager().search(
100 query, assert(this.$$('#basicPage'))); 101 query, assert(this.$$('#basicPage')));
101 102
102 if (this.pageVisibility.advancedSettings !== false) { 103 if (this.pageVisibility.advancedSettings !== false) {
103 assert(whenSearchDone === settings.getSearchManager().search( 104 assert(whenSearchDone === settings.getSearchManager().search(
104 query, assert(this.$$('#advancedPage')))); 105 query, assert(this.$.advancedPageTemplate.get())));
Dan Beam 2017/02/02 01:00:50 could this assert() fail?
dschuyler 2017/02/02 02:28:15 My expectation is that it will fail or succeed in
dpapad 2017/02/02 02:34:33 My understanding is that this assert is a left-ove
105 } 106 }
106 107
107 return whenSearchDone; 108 return whenSearchDone;
108 }, 109 },
109 110
110 /** @private */ 111 /** @private */
111 onResetDone_: function() { 112 onResetDone_: function() {
112 this.showResetProfileBanner_ = false; 113 this.showResetProfileBanner_ = false;
113 }, 114 },
114 115
115 /** 116 /**
116 * @return {boolean} 117 * @return {boolean}
117 * @private 118 * @private
118 */ 119 */
119 shouldShowAndroidApps_: function() { 120 shouldShowAndroidApps_: function() {
120 var visibility = /** @type {boolean|undefined} */ ( 121 var visibility = /** @type {boolean|undefined} */ (
121 this.get('pageVisibility.androidApps')); 122 this.get('pageVisibility.androidApps'));
122 return this.showAndroidApps && this.showPage(visibility); 123 return this.showAndroidApps && this.showPage(visibility);
123 }, 124 },
124 125
125 /** 126 /**
126 * Hides everything but the newly expanded subpage. 127 * Hides everything but the newly expanded subpage.
127 * @private 128 * @private
128 */ 129 */
129 onSubpageExpanded_: function() { 130 onSubpageExpanded_: function() {
130 this.hasExpandedSection_ = true; 131 this.hasExpandedSection_ = true;
131 }, 132 },
132 133
133 /** 134 /**
135 * Render the advanced page now (don't wait for idle).
136 * @private
137 */
138 advancedToggleExpandedChanged_: function() {
139 if (this.advancedToggleExpanded)
140 this.$.advancedPageTemplate.get();
141 },
142
143 /**
134 * @param {boolean} inSearchMode 144 * @param {boolean} inSearchMode
135 * @param {boolean} hasExpandedSection 145 * @param {boolean} hasExpandedSection
136 * @return {boolean} 146 * @return {boolean}
137 * @private 147 * @private
138 */ 148 */
139 showAdvancedToggle_: function(inSearchMode, hasExpandedSection) { 149 showAdvancedToggle_: function(inSearchMode, hasExpandedSection) {
140 return !inSearchMode && !hasExpandedSection; 150 return !inSearchMode && !hasExpandedSection;
141 }, 151 },
142 152
143 /** 153 /**
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 189
180 /** 190 /**
181 * @param {boolean} opened Whether the menu is expanded. 191 * @param {boolean} opened Whether the menu is expanded.
182 * @return {string} Icon name. 192 * @return {string} Icon name.
183 * @private 193 * @private
184 */ 194 */
185 getArrowIcon_: function(opened) { 195 getArrowIcon_: function(opened) {
186 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; 196 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down';
187 }, 197 },
188 }); 198 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698