OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/tab_util.h" | 5 #include "chrome/browser/tab_contents/tab_util.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" | 9 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 | 26 |
27 SiteInstance* GetSiteInstanceForNewTab(TabContents* source_contents, | 27 SiteInstance* GetSiteInstanceForNewTab(TabContents* source_contents, |
28 Profile* profile, | 28 Profile* profile, |
29 const GURL& url) { | 29 const GURL& url) { |
30 // If url is a WebUI or extension, we need to be sure to use the right type | 30 // If url is a WebUI or extension, we need to be sure to use the right type |
31 // of renderer process up front. Otherwise, we create a normal SiteInstance | 31 // of renderer process up front. Otherwise, we create a normal SiteInstance |
32 // as part of creating the tab. | 32 // as part of creating the tab. |
33 ExtensionService* service = profile->GetExtensionService(); | 33 ExtensionService* service = profile->GetExtensionService(); |
34 if (ChromeWebUIFactory::GetInstance()->UseWebUIForURL(profile, url) || | 34 if (ChromeWebUIFactory::GetInstance()->UseWebUIForURL(profile, url) || |
35 (service && service->GetExtensionByWebExtent(url))) { | 35 (service && |
| 36 service->extensions()->GetHostedAppByURL(ExtensionURLInfo(url)))) { |
36 return SiteInstance::CreateSiteInstanceForURL(profile, url); | 37 return SiteInstance::CreateSiteInstanceForURL(profile, url); |
37 } | 38 } |
38 | 39 |
39 if (!source_contents) | 40 if (!source_contents) |
40 return NULL; | 41 return NULL; |
41 | 42 |
42 // Don't use this logic when "--process-per-tab" is specified. | 43 // Don't use this logic when "--process-per-tab" is specified. |
43 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerTab) && | 44 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerTab) && |
44 SiteInstance::IsSameWebSite(source_contents->browser_context(), | 45 SiteInstance::IsSameWebSite(source_contents->browser_context(), |
45 source_contents->GetURL(), | 46 source_contents->GetURL(), |
46 url)) { | 47 url)) { |
47 return source_contents->GetSiteInstance(); | 48 return source_contents->GetSiteInstance(); |
48 } | 49 } |
49 return NULL; | 50 return NULL; |
50 } | 51 } |
51 | 52 |
52 } // namespace tab_util | 53 } // namespace tab_util |
OLD | NEW |