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

Unified Diff: chrome/browser/ui/browser_navigator.cc

Issue 7178002: Open Options page on top of NTP. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Refactor settings API methods together. Switch test order. Created 9 years, 6 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/ui/browser_navigator.h ('k') | chrome/browser/ui/browser_navigator_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/ui/browser_navigator.h ('k') | chrome/browser/ui/browser_navigator_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698