| 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/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 9 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
| 10 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" | 10 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 const Extension* installed_app = service->GetInstalledApp(url); | 25 const Extension* installed_app = service->GetInstalledApp(url); |
| 26 static_cast<BrowserRenderProcessHost*>(render_view_host->process())-> | 26 static_cast<BrowserRenderProcessHost*>(render_view_host->process())-> |
| 27 set_installed_app(installed_app); | 27 set_installed_app(installed_app); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 content::WebUIFactory* ChromeContentBrowserClient::GetWebUIFactory() { | 31 content::WebUIFactory* ChromeContentBrowserClient::GetWebUIFactory() { |
| 32 return ChromeWebUIFactory::GetInstance(); | 32 return ChromeWebUIFactory::GetInstance(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 GURL ChromeContentBrowserClient::GetEffectiveURL(Profile* profile, |
| 36 const GURL& url) { |
| 37 // Get the effective URL for the given actual URL. If the URL is part of an |
| 38 // installed app, the effective URL is an extension URL with the ID of that |
| 39 // extension as the host. This has the effect of grouping apps together in |
| 40 // a common SiteInstance. |
| 41 if (!profile || !profile->GetExtensionService()) |
| 42 return url; |
| 43 |
| 44 const Extension* extension = |
| 45 profile->GetExtensionService()->GetExtensionByWebExtent(url); |
| 46 if (!extension) |
| 47 return url; |
| 48 |
| 49 // If the URL is part of an extension's web extent, convert it to an |
| 50 // extension URL. |
| 51 return extension->GetResourceURL(url.path()); |
| 52 } |
| 53 |
| 35 } // namespace chrome | 54 } // namespace chrome |
| OLD | NEW |