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 OptionsPage = options.OptionsPage; | 6 /** @const */ var OptionsPage = options.OptionsPage; |
7 | 7 |
8 /** | 8 /** |
9 * Encapsulated handling of a search bubble. | 9 * Encapsulated handling of a search bubble. |
10 * @constructor | 10 * @constructor |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // Prevent recursive execution of this method. | 265 // Prevent recursive execution of this method. |
266 if (this.insideSetSearchText_) return; | 266 if (this.insideSetSearchText_) return; |
267 this.insideSetSearchText_ = true; | 267 this.insideSetSearchText_ = true; |
268 | 268 |
269 // Cleanup the search query string. | 269 // Cleanup the search query string. |
270 text = SearchPage.canonicalizeQuery(text); | 270 text = SearchPage.canonicalizeQuery(text); |
271 | 271 |
272 // Set the hash on the current page, and the enclosing uber page | 272 // Set the hash on the current page, and the enclosing uber page |
273 var hash = text ? '#' + encodeURIComponent(text) : ''; | 273 var hash = text ? '#' + encodeURIComponent(text) : ''; |
274 var path = text ? this.name : ''; | 274 var path = text ? this.name : ''; |
275 window.location.hash = hash; | 275 uber.pushState({}, path + hash); |
276 uber.invokeMethodOnParent('setPath', {path: path + hash}); | |
277 | 276 |
278 // Toggle the search page if necessary. | 277 // Toggle the search page if necessary. |
279 if (text) { | 278 if (text) { |
280 if (!this.searchActive_) | 279 if (!this.searchActive_) |
281 OptionsPage.showPageByName(this.name, false); | 280 OptionsPage.showPageByName(this.name, false); |
282 } else { | 281 } else { |
283 if (this.searchActive_) | 282 if (this.searchActive_) |
284 OptionsPage.showPageByName(OptionsPage.getDefaultPage().name, false); | 283 OptionsPage.showPageByName(OptionsPage.getDefaultPage().name, false); |
285 | 284 |
286 this.insideSetSearchText_ = false; | 285 this.insideSetSearchText_ = false; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 // Trim beginning and ending whitespace. | 568 // Trim beginning and ending whitespace. |
570 return text.replace(/^\s+|\s+$/g, ''); | 569 return text.replace(/^\s+|\s+$/g, ''); |
571 }; | 570 }; |
572 | 571 |
573 // Export | 572 // Export |
574 return { | 573 return { |
575 SearchPage: SearchPage | 574 SearchPage: SearchPage |
576 }; | 575 }; |
577 | 576 |
578 }); | 577 }); |
OLD | NEW |