OLD | NEW |
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 Loading... |
43 | 43 |
44 void ShowSingletonTabOverwritingNTP(Browser* browser, | 44 void ShowSingletonTabOverwritingNTP(Browser* browser, |
45 const NavigateParams& params) { | 45 const NavigateParams& params) { |
46 DCHECK(browser); | 46 DCHECK(browser); |
47 NavigateParams local_params(params); | 47 NavigateParams local_params(params); |
48 content::WebContents* contents = | 48 content::WebContents* contents = |
49 browser->tab_strip_model()->GetActiveWebContents(); | 49 browser->tab_strip_model()->GetActiveWebContents(); |
50 if (contents) { | 50 if (contents) { |
51 const GURL& contents_url = contents->GetURL(); | 51 const GURL& contents_url = contents->GetURL(); |
52 if ((contents_url == GURL(kChromeUINewTabURL) || IsInstantNTP(contents) || | 52 if ((contents_url == GURL(kChromeUINewTabURL) || IsInstantNTP(contents) || |
53 contents_url == GURL(content::kAboutBlankURL)) && | 53 contents_url == GURL(url::kAboutBlankURL)) && |
54 GetIndexOfSingletonTab(&local_params) < 0) { | 54 GetIndexOfSingletonTab(&local_params) < 0) { |
55 local_params.disposition = CURRENT_TAB; | 55 local_params.disposition = CURRENT_TAB; |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 Navigate(&local_params); | 59 Navigate(&local_params); |
60 } | 60 } |
61 | 61 |
62 NavigateParams GetSingletonTabNavigateParams(Browser* browser, | 62 NavigateParams GetSingletonTabNavigateParams(Browser* browser, |
63 const GURL& url) { | 63 const GURL& url) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 replacements)) { | 122 replacements)) { |
123 params->target_contents = tab; | 123 params->target_contents = tab; |
124 return tab_index; | 124 return tab_index; |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 return -1; | 128 return -1; |
129 } | 129 } |
130 | 130 |
131 } // namespace chrome | 131 } // namespace chrome |
OLD | NEW |