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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/app/breakpad_mac.h" | 8 #include "chrome/app/breakpad_mac.h" |
9 #include "chrome/browser/browser_about_handler.h" | 9 #include "chrome/browser/browser_about_handler.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 #include "chrome/browser/ui/crypto_module_password_dialog.h" | 76 #include "chrome/browser/ui/crypto_module_password_dialog.h" |
77 #endif | 77 #endif |
78 | 78 |
79 namespace { | 79 namespace { |
80 | 80 |
81 void InitRenderViewHostForExtensions(RenderViewHost* render_view_host) { | 81 void InitRenderViewHostForExtensions(RenderViewHost* render_view_host) { |
82 // Note that due to GetEffectiveURL(), even hosted apps will have a | 82 // Note that due to GetEffectiveURL(), even hosted apps will have a |
83 // chrome-extension:// URL for their site, so we can ignore that wrinkle here. | 83 // chrome-extension:// URL for their site, so we can ignore that wrinkle here. |
84 SiteInstance* site_instance = render_view_host->site_instance(); | 84 SiteInstance* site_instance = render_view_host->site_instance(); |
85 const GURL& site = site_instance->site(); | 85 const GURL& site = site_instance->site(); |
86 RenderProcessHost* process = render_view_host->process(); | |
87 | 86 |
88 if (!site.SchemeIs(chrome::kExtensionScheme)) | 87 if (!site.SchemeIs(chrome::kExtensionScheme)) |
89 return; | 88 return; |
90 | 89 |
91 Profile* profile = site_instance->browsing_instance()->profile(); | 90 Profile* profile = site_instance->browsing_instance()->profile(); |
92 ExtensionService* service = profile->GetExtensionService(); | 91 ExtensionService* service = profile->GetExtensionService(); |
93 if (!service) | 92 if (!service) |
94 return; | 93 return; |
95 | 94 |
96 ExtensionProcessManager* process_manager = | 95 ExtensionProcessManager* process_manager = |
97 profile->GetExtensionProcessManager(); | 96 profile->GetExtensionProcessManager(); |
98 CHECK(process_manager); | 97 CHECK(process_manager); |
99 | 98 |
100 // This can happen if somebody typos a chrome-extension:// URL. | 99 // This can happen if somebody typos a chrome-extension:// URL. |
101 const Extension* extension = service->GetExtensionByURL(site); | 100 const Extension* extension = service->GetExtensionByURL(site); |
102 if (!extension) | 101 if (!extension) |
103 return; | 102 return; |
104 | 103 |
105 site_instance->GetProcess()->mark_is_extension_process(); | 104 site_instance->GetProcess()->mark_is_extension_process(); |
106 | 105 |
107 // Register the association between extension and SiteInstance with | 106 // Register the association between extension and SiteInstance with |
108 // ExtensionProcessManager. | 107 // ExtensionProcessManager. |
109 // TODO(creis): Use this to replace SetInstalledAppForRenderer below. | 108 // TODO(creis): Use this to replace SetInstalledAppForRenderer below. |
110 process_manager->RegisterExtensionSiteInstance(site_instance->id(), | 109 process_manager->RegisterExtensionSiteInstance(site_instance->id(), |
111 extension->id()); | 110 extension->id()); |
112 | 111 |
| 112 RenderProcessHost* process = render_view_host->process(); |
| 113 |
113 if (extension->is_app()) { | 114 if (extension->is_app()) { |
114 render_view_host->Send( | 115 render_view_host->Send( |
115 new ExtensionMsg_ActivateApplication(extension->id())); | 116 new ExtensionMsg_ActivateApplication(extension->id())); |
116 // Record which, if any, installed app is associated with this process. | 117 // Record which, if any, installed app is associated with this process. |
117 // TODO(aa): Totally lame to store this state in a global map in extension | 118 // TODO(aa): Totally lame to store this state in a global map in extension |
118 // service. Can we get it from EPM instead? | 119 // service. Can we get it from EPM instead? |
119 service->SetInstalledAppForRenderer(process->id(), extension); | 120 service->SetInstalledAppForRenderer(process->id(), extension); |
120 } | 121 } |
121 | 122 |
122 // Some extensions use chrome:// URLs. | 123 // Some extensions use chrome:// URLs. |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 #if defined(USE_NSS) | 749 #if defined(USE_NSS) |
749 crypto::CryptoModuleBlockingPasswordDelegate* | 750 crypto::CryptoModuleBlockingPasswordDelegate* |
750 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 751 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
751 const GURL& url) { | 752 const GURL& url) { |
752 return browser::NewCryptoModuleBlockingDialogDelegate( | 753 return browser::NewCryptoModuleBlockingDialogDelegate( |
753 browser::kCryptoModulePasswordKeygen, url.host()); | 754 browser::kCryptoModulePasswordKeygen, url.host()); |
754 } | 755 } |
755 #endif | 756 #endif |
756 | 757 |
757 } // namespace chrome | 758 } // namespace chrome |
OLD | NEW |