diff options
author | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-17 22:46:37 +0000 |
---|---|---|
committer | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-17 22:46:37 +0000 |
commit | fcca741b3bf9cf8d5f94f027c04360e98461e961 (patch) | |
tree | f9744537f0ce39c162399879ba4ee60a70db0419 /chrome/browser/ui/browser_navigator.cc | |
parent | ec6033770d71040d6a7c1f826b5e655343bbcf83 (diff) | |
download | chromium_src-fcca741b3bf9cf8d5f94f027c04360e98461e961.zip chromium_src-fcca741b3bf9cf8d5f94f027c04360e98461e961.tar.gz chromium_src-fcca741b3bf9cf8d5f94f027c04360e98461e961.tar.bz2 |
Open Options page on top of NTP.
R=jhawkins@chromium.org
BUG=22951
TEST=
Review URL: http://codereview.chromium.org/7178002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89566 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_navigator.cc')
-rw-r--r-- | chrome/browser/ui/browser_navigator.cc | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index 7e01e61..fece73c 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -83,50 +83,6 @@ bool CompareURLsWithReplacements( return url_replaced == other_replaced; } -// Returns the index of an existing singleton tab in |params->browser| matching -// the URL specified in |params|. -int GetIndexOfSingletonTab(browser::NavigateParams* params) { - if (params->disposition != SINGLETON_TAB) - return -1; - - // In case the URL was rewritten by the BrowserURLHandler we need to ensure - // that we do not open another URL that will get redirected to the rewritten - // URL. - GURL rewritten_url(params->url); - bool reverse_on_redirect = false; - BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( - &rewritten_url, - params->browser->profile(), - &reverse_on_redirect); - - // If there are several matches: prefer the active tab by starting there. - int start_index = std::max(0, params->browser->active_index()); - int tab_count = params->browser->tab_count(); - for (int i = 0; i < tab_count; ++i) { - int tab_index = (start_index + i) % tab_count; - TabContentsWrapper* tab = - params->browser->GetTabContentsWrapperAt(tab_index); - - url_canon::Replacements<char> replacements; - replacements.ClearRef(); - if (params->path_behavior == browser::NavigateParams::IGNORE_AND_NAVIGATE || - params->path_behavior == browser::NavigateParams::IGNORE_AND_STAY_PUT) { - replacements.ClearPath(); - replacements.ClearQuery(); - } - - if (CompareURLsWithReplacements(tab->tab_contents()->GetURL(), - params->url, replacements) || - CompareURLsWithReplacements(tab->tab_contents()->GetURL(), - rewritten_url, replacements)) { - params->target_contents = tab; - return tab_index; - } - } - - return -1; -} - // Change some of the navigation parameters based on the particular URL. // Currently this applies to chrome://settings and the bookmark manager, // which we always want to open in a normal (not incognito) window. Guest @@ -534,4 +490,48 @@ void Navigate(NavigateParams* params) { } } +// Returns the index of an existing singleton tab in |params->browser| matching +// the URL specified in |params|. +int GetIndexOfSingletonTab(browser::NavigateParams* params) { + if (params->disposition != SINGLETON_TAB) + return -1; + + // In case the URL was rewritten by the BrowserURLHandler we need to ensure + // that we do not open another URL that will get redirected to the rewritten + // URL. + GURL rewritten_url(params->url); + bool reverse_on_redirect = false; + BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( + &rewritten_url, + params->browser->profile(), + &reverse_on_redirect); + + // If there are several matches: prefer the active tab by starting there. + int start_index = std::max(0, params->browser->active_index()); + int tab_count = params->browser->tab_count(); + for (int i = 0; i < tab_count; ++i) { + int tab_index = (start_index + i) % tab_count; + TabContentsWrapper* tab = + params->browser->GetTabContentsWrapperAt(tab_index); + + url_canon::Replacements<char> replacements; + replacements.ClearRef(); + if (params->path_behavior == browser::NavigateParams::IGNORE_AND_NAVIGATE || + params->path_behavior == browser::NavigateParams::IGNORE_AND_STAY_PUT) { + replacements.ClearPath(); + replacements.ClearQuery(); + } + + if (CompareURLsWithReplacements(tab->tab_contents()->GetURL(), + params->url, replacements) || + CompareURLsWithReplacements(tab->tab_contents()->GetURL(), + rewritten_url, replacements)) { + params->target_contents = tab; + return tab_index; + } + } + + return -1; +} + } // namespace browser |