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/debug/dump_without_crashing.h" | 7 #include "base/debug/dump_without_crashing.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
12 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
14 #include "content/public/browser/notification_types.h" | 14 #include "content/public/browser/notification_types.h" |
15 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
16 #include "extensions/browser/extension_function_dispatcher.h" | 16 #include "extensions/browser/extension_function_dispatcher.h" |
17 #include "extensions/browser/extension_registry.h" | 17 #include "extensions/browser/extension_registry.h" |
18 #include "extensions/browser/extension_util.h" | 18 #include "extensions/browser/extension_util.h" |
19 #include "extensions/browser/extensions_browser_client.h" | 19 #include "extensions/browser/extensions_browser_client.h" |
20 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 20 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
21 #include "extensions/common/extension_messages.h" | 21 #include "extensions/common/extension_messages.h" |
22 #include "extensions/common/extension_set.h" | 22 #include "extensions/common/extension_set.h" |
23 #include "extensions/common/extensions_client.h" | 23 #include "extensions/common/extensions_client.h" |
24 #include "extensions/common/features/feature_channel.h" | 24 #include "extensions/common/features/feature_channel.h" |
25 #include "extensions/common/features/feature_session_type.h" | 25 #include "extensions/common/features/feature_session_type.h" |
| 26 #include "extensions/common/permissions/permissions_data.h" |
26 #include "ui/base/webui/web_ui_util.h" | 27 #include "ui/base/webui/web_ui_util.h" |
27 | 28 |
28 using content::BrowserContext; | 29 using content::BrowserContext; |
29 | 30 |
30 namespace extensions { | 31 namespace extensions { |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
34 // Returns whether the |extension| should be loaded in the given | 35 // Returns whether the |extension| should be loaded in the given |
35 // |browser_context|. | 36 // |browser_context|. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); | 117 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); |
117 | 118 |
118 // If the new render process is a WebView guest process, propagate the WebView | 119 // If the new render process is a WebView guest process, propagate the WebView |
119 // partition ID to it. | 120 // partition ID to it. |
120 std::string webview_partition_id = WebViewGuest::GetPartitionID(process); | 121 std::string webview_partition_id = WebViewGuest::GetPartitionID(process); |
121 if (!webview_partition_id.empty()) { | 122 if (!webview_partition_id.empty()) { |
122 process->Send(new ExtensionMsg_SetWebViewPartitionID( | 123 process->Send(new ExtensionMsg_SetWebViewPartitionID( |
123 WebViewGuest::GetPartitionID(process))); | 124 WebViewGuest::GetPartitionID(process))); |
124 } | 125 } |
125 | 126 |
| 127 // Load default policy_blocked_hosts and policy_allowed_hosts settings, part |
| 128 // of the ExtensionSettings policy. |
| 129 ExtensionMsg_UpdateDefaultPolicyHostRestrictions_Params params; |
| 130 params.default_policy_blocked_hosts = |
| 131 PermissionsData::default_policy_blocked_hosts(); |
| 132 params.default_policy_allowed_hosts = |
| 133 PermissionsData::default_policy_allowed_hosts(); |
| 134 process->Send(new ExtensionMsg_UpdateDefaultPolicyHostRestrictions(params)); |
| 135 |
126 // Loaded extensions. | 136 // Loaded extensions. |
127 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; | 137 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; |
128 BrowserContext* renderer_context = process->GetBrowserContext(); | 138 BrowserContext* renderer_context = process->GetBrowserContext(); |
129 const ExtensionSet& extensions = | 139 const ExtensionSet& extensions = |
130 ExtensionRegistry::Get(browser_context_)->enabled_extensions(); | 140 ExtensionRegistry::Get(browser_context_)->enabled_extensions(); |
131 for (const auto& ext : extensions) { | 141 for (const auto& ext : extensions) { |
132 // OnLoadedExtension should have already been called for the extension. | 142 // OnLoadedExtension should have already been called for the extension. |
133 DCHECK(base::ContainsKey(extension_process_map_, ext->id())); | 143 DCHECK(base::ContainsKey(extension_process_map_, ext->id())); |
134 DCHECK(!base::ContainsKey(extension_process_map_[ext->id()], process)); | 144 DCHECK(!base::ContainsKey(extension_process_map_[ext->id()], process)); |
135 | 145 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 BrowserContext* context) const { | 296 BrowserContext* context) const { |
287 // Redirected in incognito. | 297 // Redirected in incognito. |
288 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 298 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
289 } | 299 } |
290 | 300 |
291 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { | 301 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { |
292 return true; | 302 return true; |
293 } | 303 } |
294 | 304 |
295 } // namespace extensions | 305 } // namespace extensions |
OLD | NEW |