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

Unified Diff: chrome/browser/resources/options/search_page.js

Issue 555163007: Settings: manage location.hash explicitly on a Page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dbeam comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/options/options.js ('k') | chrome/browser/ui/webui/options/options_browsertest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/search_page.js
diff --git a/chrome/browser/resources/options/search_page.js b/chrome/browser/resources/options/search_page.js
index 887a13af073c7713d66dc2c191f6acae8bd953a0..9441bf174c2e9588518b88a6472a4d7c32f59567 100644
--- a/chrome/browser/resources/options/search_page.js
+++ b/chrome/browser/resources/options/search_page.js
@@ -172,6 +172,11 @@ cr.define('options', function() {
this.setSearchActive_(true);
},
+ /** @override */
+ didChangeHash: function() {
+ this.setSearchActive_(true);
+ },
+
/**
* Called before this page will be hidden.
*/
@@ -200,7 +205,7 @@ cr.define('options', function() {
this.searchActive_ = active;
if (active) {
- var hash = location.hash;
+ var hash = this.hash;
if (hash) {
this.searchField.value =
decodeURIComponent(hash.slice(1).replace(/\+/g, ' '));
@@ -219,6 +224,8 @@ cr.define('options', function() {
for (var i = 0, section; section = this.advancedSections_[i]; i++)
$('settings').appendChild(section);
}
+ } else {
+ this.searchField.value = '';
}
var pagesToSearch = this.getSearchablePages_();
@@ -280,25 +287,23 @@ cr.define('options', function() {
// Cleanup the search query string.
text = SearchPage.canonicalizeQuery(text);
- // Set the hash on the current page, and the enclosing uber page. Only do
- // this if the page is not current. See https://crbug.com/401004.
- var hash = text ? '#' + encodeURIComponent(text) : '';
- var path = text ? this.name : '';
- if (location.hash != hash || location.pathname != '/' + path)
- uber.pushState({}, path + hash);
-
- // Toggle the search page if necessary.
- if (text) {
- if (!this.searchActive_)
- PageManager.showPageByName(this.name, false);
- } else {
+ // If the search string becomes empty, flip back to the default page.
+ if (!text) {
if (this.searchActive_)
- PageManager.showDefaultPage(false);
-
+ PageManager.showDefaultPage();
this.insideSetSearchText_ = false;
return;
}
+ // Toggle the search page if necessary. Otherwise, update the hash.
+ var hash = '#' + encodeURIComponent(text);
+ if (this.searchActive_) {
+ if (this.hash != hash)
+ this.setHash(hash);
+ } else {
+ PageManager.showPageByName(this.name, true, {hash: hash});
+ }
+
var foundMatches = false;
// Remove any prior search results.
« no previous file with comments | « chrome/browser/resources/options/options.js ('k') | chrome/browser/ui/webui/options/options_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698