| 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/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_controller_factory.h" | 9 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 SiteInstance* GetSiteInstanceForNewTab(Profile* profile, | 32 SiteInstance* GetSiteInstanceForNewTab(Profile* profile, |
| 33 const GURL& url) { | 33 const GURL& url) { |
| 34 // If url is a WebUI or extension, we need to be sure to use the right type | 34 // If url is a WebUI or extension, we need to be sure to use the right type |
| 35 // of renderer process up front. Otherwise, we create a normal SiteInstance | 35 // of renderer process up front. Otherwise, we create a normal SiteInstance |
| 36 // as part of creating the tab. | 36 // as part of creating the tab. |
| 37 ExtensionService* service = profile->GetExtensionService(); | 37 ExtensionService* service = profile->GetExtensionService(); |
| 38 if (ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL( | 38 if (ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL( |
| 39 profile, url) || | 39 profile, url) || |
| 40 (service && | 40 (service && |
| 41 service->extensions()->GetHostedAppByURL(ExtensionURLInfo(url)))) { | 41 service->extensions()->GetHostedAppByURL(url))) { |
| 42 return SiteInstance::CreateForURL(profile, url); | 42 return SiteInstance::CreateForURL(profile, url); |
| 43 } | 43 } |
| 44 | 44 |
| 45 // We used to share the SiteInstance for same-site links opened in new tabs, | 45 // We used to share the SiteInstance for same-site links opened in new tabs, |
| 46 // to leverage the in-memory cache and reduce process creation. It now | 46 // to leverage the in-memory cache and reduce process creation. It now |
| 47 // appears that it is more useful to have such links open in a new process. | 47 // appears that it is more useful to have such links open in a new process. |
| 48 return NULL; | 48 return NULL; |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace tab_util | 51 } // namespace tab_util |
| OLD | NEW |