| 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/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/tabs/tab_strip_model.h" | 9 #include "chrome/browser/tabs/tab_strip_model.h" |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 11 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
| 12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
| 13 #include "chrome/browser/sessions/restore_tab_helper.h" | 13 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 14 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | 14 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
| 15 #include "chrome/browser/net/url_fixer_upper.h" | |
| 16 #include "chrome/common/extensions/extension.h" | |
| 17 #include "chrome/common/url_constants.h" | |
| 18 #include "content/public/browser/favicon_status.h" | 15 #include "content/public/browser/favicon_status.h" |
| 19 #include "content/public/browser/navigation_entry.h" | 16 #include "content/public/browser/navigation_entry.h" |
| 20 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 21 #include "googleurl/src/gurl.h" | |
| 22 | 18 |
| 23 namespace keys = extension_tabs_module_constants; | 19 namespace keys = extension_tabs_module_constants; |
| 24 namespace errors = extension_manifest_errors; | 20 namespace errors = extension_manifest_errors; |
| 25 | 21 |
| 26 using content::NavigationEntry; | 22 using content::NavigationEntry; |
| 27 using content::WebContents; | 23 using content::WebContents; |
| 28 | 24 |
| 29 int ExtensionTabUtil::GetWindowId(const Browser* browser) { | 25 int ExtensionTabUtil::GetWindowId(const Browser* browser) { |
| 30 return browser->session_id().id(); | 26 return browser->session_id().id(); |
| 31 } | 27 } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 *contents = target_contents; | 216 *contents = target_contents; |
| 221 if (tab_index) | 217 if (tab_index) |
| 222 *tab_index = i; | 218 *tab_index = i; |
| 223 return true; | 219 return true; |
| 224 } | 220 } |
| 225 } | 221 } |
| 226 } | 222 } |
| 227 } | 223 } |
| 228 return false; | 224 return false; |
| 229 } | 225 } |
| 230 | |
| 231 GURL ExtensionTabUtil::ResolvePossiblyRelativeURL(const std::string& url_string, | |
| 232 const Extension* extension) { | |
| 233 GURL url = GURL(url_string); | |
| 234 if (!url.is_valid()) | |
| 235 url = extension->GetResourceURL(url_string); | |
| 236 | |
| 237 return url; | |
| 238 } | |
| 239 | |
| 240 bool ExtensionTabUtil::IsCrashURL(const GURL& url) { | |
| 241 // Check a fixed-up URL, to normalize the scheme and parse hosts correctly. | |
| 242 GURL fixed_url = | |
| 243 URLFixerUpper::FixupURL(url.possibly_invalid_spec(), std::string()); | |
| 244 return (fixed_url.SchemeIs(chrome::kChromeUIScheme) && | |
| 245 (fixed_url.host() == chrome::kChromeUIBrowserCrashHost || | |
| 246 fixed_url.host() == chrome::kChromeUICrashHost)); | |
| 247 } | |
| OLD | NEW |