Index: chrome/browser/ui/browser_navigator.cc |
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc |
index 7e01e615f61f920d3bdee21d24eb0b87b293ac07..fece73c47201f1f91bba86d53e3ba05f62749aac 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 |