Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/renderer_startup_helper.h" | 5 #include "extensions/browser/renderer_startup_helper.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 9 #include "content/public/browser/notification_service.h" | 9 #include "content/public/browser/notification_service.h" |
| 10 #include "content/public/browser/notification_types.h" | 10 #include "content/public/browser/notification_types.h" |
| 11 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
| 12 #include "extensions/browser/extension_function_dispatcher.h" | 12 #include "extensions/browser/extension_function_dispatcher.h" |
| 13 #include "extensions/browser/extension_registry.h" | 13 #include "extensions/browser/extension_registry.h" |
| 14 #include "extensions/browser/extensions_browser_client.h" | 14 #include "extensions/browser/extensions_browser_client.h" |
| 15 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 15 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
| 16 #include "extensions/common/extension_messages.h" | 16 #include "extensions/common/extension_messages.h" |
| 17 #include "extensions/common/extension_set.h" | 17 #include "extensions/common/extension_set.h" |
| 18 #include "extensions/common/extensions_client.h" | 18 #include "extensions/common/extensions_client.h" |
| 19 #include "extensions/common/features/feature_channel.h" | 19 #include "extensions/common/features/feature_channel.h" |
| 20 #include "extensions/common/features/feature_session_type.h" | 20 #include "extensions/common/features/feature_session_type.h" |
| 21 #include "extensions/common/permissions/permissions_data.h" | |
| 22 #include "ipc/ipc_message_attachment_set.h" | |
|
Devlin
2017/04/03 15:52:23
needed?
nrpeter
2017/04/03 22:35:48
Done.
| |
| 21 #include "ui/base/webui/web_ui_util.h" | 23 #include "ui/base/webui/web_ui_util.h" |
| 22 | 24 |
| 23 using content::BrowserContext; | 25 using content::BrowserContext; |
| 24 | 26 |
| 25 namespace extensions { | 27 namespace extensions { |
| 26 | 28 |
| 27 RendererStartupHelper::RendererStartupHelper(BrowserContext* browser_context) | 29 RendererStartupHelper::RendererStartupHelper(BrowserContext* browser_context) |
| 28 : browser_context_(browser_context) { | 30 : browser_context_(browser_context) { |
| 29 DCHECK(browser_context); | 31 DCHECK(browser_context); |
| 30 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 32 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); | 86 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); |
| 85 | 87 |
| 86 // If the new render process is a WebView guest process, propagate the WebView | 88 // If the new render process is a WebView guest process, propagate the WebView |
| 87 // partition ID to it. | 89 // partition ID to it. |
| 88 std::string webview_partition_id = WebViewGuest::GetPartitionID(process); | 90 std::string webview_partition_id = WebViewGuest::GetPartitionID(process); |
| 89 if (!webview_partition_id.empty()) { | 91 if (!webview_partition_id.empty()) { |
| 90 process->Send(new ExtensionMsg_SetWebViewPartitionID( | 92 process->Send(new ExtensionMsg_SetWebViewPartitionID( |
| 91 WebViewGuest::GetPartitionID(process))); | 93 WebViewGuest::GetPartitionID(process))); |
| 92 } | 94 } |
| 93 | 95 |
| 96 // Load default policy_blocked_hosts and policy_allowed_hosts settings, part | |
| 97 // of the ExtensionSettings policy. | |
| 98 ExtensionMsg_UpdateDefaultPolicyHostRestrictions_Params params; | |
| 99 params.default_policy_blocked_hosts = | |
| 100 PermissionsData::default_policy_blocked_hosts(); | |
| 101 params.default_policy_allowed_hosts = | |
| 102 PermissionsData::default_policy_allowed_hosts(); | |
| 103 process->Send(new ExtensionMsg_UpdateDefaultPolicyHostRestrictions(params)); | |
| 104 | |
| 94 // Loaded extensions. | 105 // Loaded extensions. |
| 95 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; | 106 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; |
| 96 const ExtensionSet& extensions = | 107 const ExtensionSet& extensions = |
| 97 ExtensionRegistry::Get(browser_context_)->enabled_extensions(); | 108 ExtensionRegistry::Get(browser_context_)->enabled_extensions(); |
| 98 for (const auto& ext : extensions) { | 109 for (const auto& ext : extensions) { |
| 99 // Renderers don't need to know about themes. | 110 // Renderers don't need to know about themes. |
| 100 if (!ext->is_theme()) { | 111 if (!ext->is_theme()) { |
| 101 // TODO(kalman): Only include tab specific permissions for extension | 112 // TODO(kalman): Only include tab specific permissions for extension |
| 102 // processes, no other process needs it, so it's mildly wasteful. | 113 // processes, no other process needs it, so it's mildly wasteful. |
| 103 // I am not sure this is possible to know this here, at such a low | 114 // I am not sure this is possible to know this here, at such a low |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 BrowserContext* context) const { | 215 BrowserContext* context) const { |
| 205 // Redirected in incognito. | 216 // Redirected in incognito. |
| 206 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 217 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
| 207 } | 218 } |
| 208 | 219 |
| 209 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { | 220 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { |
| 210 return true; | 221 return true; |
| 211 } | 222 } |
| 212 | 223 |
| 213 } // namespace extensions | 224 } // namespace extensions |
| OLD | NEW |