diff options
author | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 18:05:53 +0000 |
---|---|---|
committer | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 18:05:53 +0000 |
commit | 18699b72815f6f435c4e00f4f1eb900440898468 (patch) | |
tree | b8184bec13f5f966fdc7f44330eeca0691780882 /chrome/browser/resources | |
parent | c88573e10ceecc3b3d5676c21307c42f6328dc05 (diff) | |
download | chromium_src-18699b72815f6f435c4e00f4f1eb900440898468.zip chromium_src-18699b72815f6f435c4e00f4f1eb900440898468.tar.gz chromium_src-18699b72815f6f435c4e00f4f1eb900440898468.tar.bz2 |
web-ui settings: Fix so that an overlay does not discard the search session.
BUG=74468
TEST=Perform a search, display an overlay, close the overlay. Search should still be active.
Review URL: http://codereview.chromium.org/6594093
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76559 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r-- | chrome/browser/resources/options/options_page.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/chrome/browser/resources/options/options_page.js b/chrome/browser/resources/options/options_page.js index 2049149..4890799 100644 --- a/chrome/browser/resources/options/options_page.js +++ b/chrome/browser/resources/options/options_page.js @@ -75,10 +75,21 @@ cr.define('options', function() { * @private */ OptionsPage.showPageByName = function(pageName, updateHistory) { + // Find the currently visible root-level page. + var rootPage = null; + for (var name in this.registeredPages) { + var page = this.registeredPages[name]; + if (page.visible && !page.parentPage) { + rootPage = page; + break; + } + } + + // Find the target page. var targetPage = this.registeredPages[pageName]; if (!targetPage || !targetPage.canShowPage()) { // If it's not a page, try it as an overlay. - if (!targetPage && this.showOverlay_(pageName)) { + if (!targetPage && this.showOverlay_(pageName, rootPage)) { if (updateHistory) this.updateHistoryState_(); return; @@ -92,14 +103,6 @@ cr.define('options', function() { // Determine if the root page is 'sticky', meaning that it // shouldn't change when showing a sub-page. This can happen for special // pages like Search. - var rootPage = null; - for (var name in this.registeredPages) { - var page = this.registeredPages[name]; - if (page.visible && !page.parentPage) { - rootPage = page; - break; - } - } var isRootPageLocked = rootPage && rootPage.sticky && targetPage.parentPage; @@ -191,14 +194,15 @@ cr.define('options', function() { /** * Shows a registered Overlay page. Does not update history. * @param {string} overlayName Page name. + * @param {OptionPage} rootPage The currently visible root-level page. * @return {boolean} whether we showed an overlay. */ - OptionsPage.showOverlay_ = function(overlayName) { + OptionsPage.showOverlay_ = function(overlayName, rootPage) { var overlay = this.registeredOverlayPages[overlayName]; if (!overlay || !overlay.canShowPage()) return false; - if (overlay.parentPage) + if ((!rootPage || !rootPage.sticky) && overlay.parentPage) this.showPageByName(overlay.parentPage.name, false); this.registeredOverlayPages[overlayName].visible = true; |