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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
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) || |
| 53 search::IsInstantNTP(contents) || |
53 contents_url == GURL(url::kAboutBlankURL)) && | 54 contents_url == GURL(url::kAboutBlankURL)) && |
54 GetIndexOfSingletonTab(&local_params) < 0) { | 55 GetIndexOfSingletonTab(&local_params) < 0) { |
55 local_params.disposition = CURRENT_TAB; | 56 local_params.disposition = CURRENT_TAB; |
56 } | 57 } |
57 } | 58 } |
58 | 59 |
59 Navigate(&local_params); | 60 Navigate(&local_params); |
60 } | 61 } |
61 | 62 |
62 NavigateParams GetSingletonTabNavigateParams(Browser* browser, | 63 NavigateParams GetSingletonTabNavigateParams(Browser* browser, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 replacements)) { | 123 replacements)) { |
123 params->target_contents = tab; | 124 params->target_contents = tab; |
124 return tab_index; | 125 return tab_index; |
125 } | 126 } |
126 } | 127 } |
127 | 128 |
128 return -1; | 129 return -1; |
129 } | 130 } |
130 | 131 |
131 } // namespace chrome | 132 } // namespace chrome |
OLD | NEW |