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/extensions/extension_tab_util.h" | 5 #include "chrome/browser/extensions/extension_tab_util.h" |
6 | 6 |
7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
8 #include "chrome/browser/extensions/extension_tab_helper.h" | 8 #include "chrome/browser/extensions/extension_tab_helper.h" |
9 #include "chrome/browser/net/url_fixer_upper.h" | 9 #include "chrome/browser/net/url_fixer_upper.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/sessions/restore_tab_helper.h" | 11 #include "chrome/browser/sessions/restore_tab_helper.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/browser_tabstrip.h" |
14 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
18 #include "chrome/common/extensions/extension_manifest_constants.h" | 19 #include "chrome/common/extensions/extension_manifest_constants.h" |
19 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
20 #include "content/public/browser/favicon_status.h" | 21 #include "content/public/browser/favicon_status.h" |
21 #include "content/public/browser/navigation_entry.h" | 22 #include "content/public/browser/navigation_entry.h" |
22 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
23 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 149 |
149 return false; | 150 return false; |
150 } | 151 } |
151 | 152 |
152 bool ExtensionTabUtil::GetDefaultTab(Browser* browser, | 153 bool ExtensionTabUtil::GetDefaultTab(Browser* browser, |
153 TabContents** contents, | 154 TabContents** contents, |
154 int* tab_id) { | 155 int* tab_id) { |
155 DCHECK(browser); | 156 DCHECK(browser); |
156 DCHECK(contents); | 157 DCHECK(contents); |
157 | 158 |
158 *contents = browser->GetActiveTabContents(); | 159 *contents = chrome::GetActiveTabContents(browser); |
159 if (*contents) { | 160 if (*contents) { |
160 if (tab_id) | 161 if (tab_id) |
161 *tab_id = ExtensionTabUtil::GetTabId((*contents)->web_contents()); | 162 *tab_id = ExtensionTabUtil::GetTabId((*contents)->web_contents()); |
162 return true; | 163 return true; |
163 } | 164 } |
164 | 165 |
165 return false; | 166 return false; |
166 } | 167 } |
167 | 168 |
168 bool ExtensionTabUtil::GetTabById(int tab_id, | 169 bool ExtensionTabUtil::GetTabById(int tab_id, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 212 } |
212 | 213 |
213 bool ExtensionTabUtil::IsCrashURL(const GURL& url) { | 214 bool ExtensionTabUtil::IsCrashURL(const GURL& url) { |
214 // Check a fixed-up URL, to normalize the scheme and parse hosts correctly. | 215 // Check a fixed-up URL, to normalize the scheme and parse hosts correctly. |
215 GURL fixed_url = | 216 GURL fixed_url = |
216 URLFixerUpper::FixupURL(url.possibly_invalid_spec(), std::string()); | 217 URLFixerUpper::FixupURL(url.possibly_invalid_spec(), std::string()); |
217 return (fixed_url.SchemeIs(chrome::kChromeUIScheme) && | 218 return (fixed_url.SchemeIs(chrome::kChromeUIScheme) && |
218 (fixed_url.host() == chrome::kChromeUIBrowserCrashHost || | 219 (fixed_url.host() == chrome::kChromeUIBrowserCrashHost || |
219 fixed_url.host() == chrome::kChromeUICrashHost)); | 220 fixed_url.host() == chrome::kChromeUICrashHost)); |
220 } | 221 } |
OLD | NEW |