OLD | NEW |
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 this.keyDownEventHandler_.bind(this)); | 150 this.keyDownEventHandler_.bind(this)); |
151 }, | 151 }, |
152 | 152 |
153 /** @override */ | 153 /** @override */ |
154 get sticky() { | 154 get sticky() { |
155 return true; | 155 return true; |
156 }, | 156 }, |
157 | 157 |
158 /** | 158 /** |
159 * Called after this page has shown. | 159 * Called after this page has shown. |
| 160 * @override |
160 */ | 161 */ |
161 didShowPage: function() { | 162 didShowPage: function() { |
162 // This method is called by the Options page after all pages have | 163 // This method is called by PageManager after all pages have had their |
163 // had their visibilty attribute set. At this point we can perform the | 164 // visibility attribute set. At this point we can perform the |
164 // search specific DOM manipulation. | 165 // search-specific DOM manipulation. |
165 this.setSearchActive_(true); | 166 this.setSearchActive_(true); |
166 }, | 167 }, |
167 | 168 |
168 /** | 169 /** |
169 * Called before this page will be hidden. | 170 * Called before this page will be hidden. |
| 171 * @override |
170 */ | 172 */ |
171 willHidePage: function() { | 173 willHidePage: function() { |
172 // This method is called by the Options page before all pages have | 174 // This method is called by PageManager before all pages have had their |
173 // their visibilty attribute set. Before that happens, we need to | 175 // visibility attribute set. Before that happens, we need to undo the |
174 // undo the search specific DOM manipulation that was performed in | 176 // search-specific DOM manipulation that was performed in didShowPage. |
175 // didShowPage. | |
176 this.setSearchActive_(false); | 177 this.setSearchActive_(false); |
177 }, | 178 }, |
178 | 179 |
179 /** | 180 /** |
180 * Update the UI to reflect whether we are in a search state. | 181 * Update the UI to reflect whether we are in a search state. |
181 * @param {boolean} active True if we are on the search page. | 182 * @param {boolean} active True if we are on the search page. |
182 * @private | 183 * @private |
183 */ | 184 */ |
184 setSearchActive_: function(active) { | 185 setSearchActive_: function(active) { |
185 // It's fine to exit if search wasn't active and we're not going to | 186 // It's fine to exit if search wasn't active and we're not going to |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 // Trim beginning and ending whitespace. | 569 // Trim beginning and ending whitespace. |
569 return text.replace(/^\s+|\s+$/g, ''); | 570 return text.replace(/^\s+|\s+$/g, ''); |
570 }; | 571 }; |
571 | 572 |
572 // Export | 573 // Export |
573 return { | 574 return { |
574 SearchPage: SearchPage | 575 SearchPage: SearchPage |
575 }; | 576 }; |
576 | 577 |
577 }); | 578 }); |
OLD | NEW |