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

Side by Side Diff: chrome/browser/resources/options/search_page.js

Issue 514503002: Clean up cr.ui.pageManager.Page prototype (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.define('options', function() { 5 cr.define('options', function() {
6 /** @const */ var Page = cr.ui.pageManager.Page; 6 /** @const */ var Page = cr.ui.pageManager.Page;
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager;
8 8
9 /** 9 /**
10 * Encapsulated handling of a search bubble. 10 * Encapsulated handling of a search bubble.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // Install handler for key presses. 157 // Install handler for key presses.
158 document.addEventListener('keydown', 158 document.addEventListener('keydown',
159 this.keyDownEventHandler_.bind(this)); 159 this.keyDownEventHandler_.bind(this));
160 }, 160 },
161 161
162 /** @override */ 162 /** @override */
163 get sticky() { 163 get sticky() {
164 return true; 164 return true;
165 }, 165 },
166 166
167 /** 167 /** @override */
168 * Called after this page has shown.
169 */
170 didShowPage: function() { 168 didShowPage: function() {
171 // This method is called by the Options page after all pages have 169 // This method is called by the PageManager after all pages have had their
172 // had their visibilty attribute set. At this point we can perform the 170 // visibility attribute set. At this point we can perform the
173 // search specific DOM manipulation. 171 // search-specific DOM manipulation.
174 this.setSearchActive_(true); 172 this.setSearchActive_(true);
175 }, 173 },
176 174
177 /** @override */ 175 /** @override */
178 didChangeHash: function() { 176 didChangeHash: function() {
179 this.setSearchActive_(true); 177 this.setSearchActive_(true);
180 }, 178 },
181 179
182 /** 180 /** @override */
183 * Called before this page will be hidden.
184 */
185 willHidePage: function() { 181 willHidePage: function() {
186 // This method is called by the Options page before all pages have 182 // This method is called by the PageManager before all pages have their
187 // their visibilty attribute set. Before that happens, we need to 183 // visibility attribute set. Before that happens, we need to undo the
188 // undo the search specific DOM manipulation that was performed in 184 // search-specific DOM manipulation that was performed in didShowPage.
189 // didShowPage.
190 this.setSearchActive_(false); 185 this.setSearchActive_(false);
191 }, 186 },
192 187
193 /** 188 /**
194 * Update the UI to reflect whether we are in a search state. 189 * Update the UI to reflect whether we are in a search state.
195 * @param {boolean} active True if we are on the search page. 190 * @param {boolean} active True if we are on the search page.
196 * @private 191 * @private
197 */ 192 */
198 setSearchActive_: function(active) { 193 setSearchActive_: function(active) {
199 // It's fine to exit if search wasn't active and we're not going to 194 // It's fine to exit if search wasn't active and we're not going to
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 // Trim beginning and ending whitespace. 583 // Trim beginning and ending whitespace.
589 return text.replace(/^\s+|\s+$/g, ''); 584 return text.replace(/^\s+|\s+$/g, '');
590 }; 585 };
591 586
592 // Export 587 // Export
593 return { 588 return {
594 SearchPage: SearchPage 589 SearchPage: SearchPage
595 }; 590 };
596 591
597 }); 592 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/font_settings.js ('k') | ui/webui/resources/js/cr/ui/page_manager/page.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698