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

Side by Side Diff: chrome/browser/ui/singleton_tabs.cc

Issue 2409423005: Compare GURLs to kUrlConstants with .spec() and string equality (Closed)
Patch Set: rebase on dependent patch Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/singleton_tabs.h" 5 #include "chrome/browser/ui/singleton_tabs.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/search/search.h" 8 #include "chrome/browser/search/search.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_navigator.h" 10 #include "chrome/browser/ui/browser_navigator.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 void ShowSingletonTabOverwritingNTP(Browser* browser, 45 void ShowSingletonTabOverwritingNTP(Browser* browser,
46 const NavigateParams& params) { 46 const NavigateParams& params) {
47 DCHECK(browser); 47 DCHECK(browser);
48 NavigateParams local_params(params); 48 NavigateParams local_params(params);
49 content::WebContents* contents = 49 content::WebContents* contents =
50 browser->tab_strip_model()->GetActiveWebContents(); 50 browser->tab_strip_model()->GetActiveWebContents();
51 if (contents) { 51 if (contents) {
52 const GURL& contents_url = contents->GetURL(); 52 const GURL& contents_url = contents->GetURL();
53 if ((contents_url == GURL(kChromeUINewTabURL) || 53 if ((contents_url == kChromeUINewTabURL || search::IsInstantNTP(contents) ||
54 search::IsInstantNTP(contents) || 54 contents_url == url::kAboutBlankURL) &&
55 contents_url == GURL(url::kAboutBlankURL)) &&
56 GetIndexOfSingletonTab(&local_params) < 0) { 55 GetIndexOfSingletonTab(&local_params) < 0) {
57 local_params.disposition = WindowOpenDisposition::CURRENT_TAB; 56 local_params.disposition = WindowOpenDisposition::CURRENT_TAB;
58 } 57 }
59 } 58 }
60 59
61 Navigate(&local_params); 60 Navigate(&local_params);
62 } 61 }
63 62
64 NavigateParams GetSingletonTabNavigateParams(Browser* browser, 63 NavigateParams GetSingletonTabNavigateParams(Browser* browser,
65 const GURL& url) { 64 const GURL& url) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 replacements)) { 123 replacements)) {
125 params->target_contents = tab; 124 params->target_contents = tab;
126 return tab_index; 125 return tab_index;
127 } 126 }
128 } 127 }
129 128
130 return -1; 129 return -1;
131 } 130 }
132 131
133 } // namespace chrome 132 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.cc ('k') | chrome/browser/ui/startup/startup_browser_creator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698