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

Side by Side 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: Add support for about:blank and tests. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser_navigator.h" 5 #include "chrome/browser/ui/browser_navigator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/browser/browser_about_handler.h" 10 #include "chrome/browser/browser_about_handler.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 const GURL& other, 76 const GURL& other,
77 const url_canon::Replacements<char>& replacements) { 77 const url_canon::Replacements<char>& replacements) {
78 if (url == other) 78 if (url == other)
79 return true; 79 return true;
80 80
81 GURL url_replaced = url.ReplaceComponents(replacements); 81 GURL url_replaced = url.ReplaceComponents(replacements);
82 GURL other_replaced = other.ReplaceComponents(replacements); 82 GURL other_replaced = other.ReplaceComponents(replacements);
83 return url_replaced == other_replaced; 83 return url_replaced == other_replaced;
84 } 84 }
85 85
86 } // anonymous namespace
James Hawkins 2011/06/17 17:44:57 s/anonymous namespace/namespace/ Technically it's
Greg Billock 2011/06/17 21:16:07 Done.
87
88 namespace browser {
89
86 // Returns the index of an existing singleton tab in |params->browser| matching 90 // Returns the index of an existing singleton tab in |params->browser| matching
87 // the URL specified in |params|. 91 // the URL specified in |params|.
88 int GetIndexOfSingletonTab(browser::NavigateParams* params) { 92 int GetIndexOfSingletonTab(browser::NavigateParams* params) {
89 if (params->disposition != SINGLETON_TAB) 93 if (params->disposition != SINGLETON_TAB)
90 return -1; 94 return -1;
91 95
92 // In case the URL was rewritten by the BrowserURLHandler we need to ensure 96 // In case the URL was rewritten by the BrowserURLHandler we need to ensure
93 // that we do not open another URL that will get redirected to the rewritten 97 // that we do not open another URL that will get redirected to the rewritten
94 // URL. 98 // URL.
95 GURL rewritten_url(params->url); 99 GURL rewritten_url(params->url);
(...skipping 24 matching lines...) Expand all
120 CompareURLsWithReplacements(tab->tab_contents()->GetURL(), 124 CompareURLsWithReplacements(tab->tab_contents()->GetURL(),
121 rewritten_url, replacements)) { 125 rewritten_url, replacements)) {
122 params->target_contents = tab; 126 params->target_contents = tab;
123 return tab_index; 127 return tab_index;
124 } 128 }
125 } 129 }
126 130
127 return -1; 131 return -1;
128 } 132 }
129 133
134 } // namespace browser
135
136 namespace {
James Hawkins 2011/06/17 17:44:57 Why do we have two unnamed namespaces?
Greg Billock 2011/06/17 21:16:07 Just so the diffs are easier to follow. I plan to
137
130 // Change some of the navigation parameters based on the particular URL. 138 // Change some of the navigation parameters based on the particular URL.
131 // Currently this applies to chrome://settings and the bookmark manager, 139 // Currently this applies to chrome://settings and the bookmark manager,
132 // which we always want to open in a normal (not incognito) window. Guest 140 // which we always want to open in a normal (not incognito) window. Guest
133 // session is an exception. 141 // session is an exception.
134 void AdjustNavigateParamsForURL(browser::NavigateParams* params) { 142 void AdjustNavigateParamsForURL(browser::NavigateParams* params) {
135 if (!params->target_contents && 143 if (!params->target_contents &&
136 params->url.scheme() == chrome::kChromeUIScheme && 144 params->url.scheme() == chrome::kChromeUIScheme &&
137 (params->url.host() == chrome::kChromeUISettingsHost || 145 (params->url.host() == chrome::kChromeUISettingsHost ||
138 params->url.host() == chrome::kChromeUIBookmarksHost)) { 146 params->url.host() == chrome::kChromeUIBookmarksHost)) {
139 Profile* profile = 147 Profile* profile =
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 params->url, params->referrer, params->transition); 536 params->url, params->referrer, params->transition);
529 } 537 }
530 538
531 // If the singleton tab isn't already selected, select it. 539 // If the singleton tab isn't already selected, select it.
532 if (params->source_contents != params->target_contents) 540 if (params->source_contents != params->target_contents)
533 params->browser->ActivateTabAt(singleton_index, user_initiated); 541 params->browser->ActivateTabAt(singleton_index, user_initiated);
534 } 542 }
535 } 543 }
536 544
537 } // namespace browser 545 } // namespace browser
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698