Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: extensions/browser/renderer_startup_helper.cc

Issue 2820333003: Revert of Communicate ExtensionSettings policy to renderers (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
27 #include "ui/base/webui/web_ui_util.h" 26 #include "ui/base/webui/web_ui_util.h"
28 27
29 using content::BrowserContext; 28 using content::BrowserContext;
30 29
31 namespace extensions { 30 namespace extensions {
32 31
33 namespace { 32 namespace {
34 33
35 // Returns whether the |extension| should be loaded in the given 34 // Returns whether the |extension| should be loaded in the given
36 // |browser_context|. 35 // |browser_context|.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); 116 extensions::ExtensionsClient::Get()->GetScriptingWhitelist()));
118 117
119 // If the new render process is a WebView guest process, propagate the WebView 118 // If the new render process is a WebView guest process, propagate the WebView
120 // partition ID to it. 119 // partition ID to it.
121 std::string webview_partition_id = WebViewGuest::GetPartitionID(process); 120 std::string webview_partition_id = WebViewGuest::GetPartitionID(process);
122 if (!webview_partition_id.empty()) { 121 if (!webview_partition_id.empty()) {
123 process->Send(new ExtensionMsg_SetWebViewPartitionID( 122 process->Send(new ExtensionMsg_SetWebViewPartitionID(
124 WebViewGuest::GetPartitionID(process))); 123 WebViewGuest::GetPartitionID(process)));
125 } 124 }
126 125
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
136 // Loaded extensions. 126 // Loaded extensions.
137 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; 127 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions;
138 BrowserContext* renderer_context = process->GetBrowserContext(); 128 BrowserContext* renderer_context = process->GetBrowserContext();
139 const ExtensionSet& extensions = 129 const ExtensionSet& extensions =
140 ExtensionRegistry::Get(browser_context_)->enabled_extensions(); 130 ExtensionRegistry::Get(browser_context_)->enabled_extensions();
141 for (const auto& ext : extensions) { 131 for (const auto& ext : extensions) {
142 // OnLoadedExtension should have already been called for the extension. 132 // OnLoadedExtension should have already been called for the extension.
143 DCHECK(base::ContainsKey(extension_process_map_, ext->id())); 133 DCHECK(base::ContainsKey(extension_process_map_, ext->id()));
144 DCHECK(!base::ContainsKey(extension_process_map_[ext->id()], process)); 134 DCHECK(!base::ContainsKey(extension_process_map_[ext->id()], process));
145 135
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 BrowserContext* context) const { 286 BrowserContext* context) const {
297 // Redirected in incognito. 287 // Redirected in incognito.
298 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); 288 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
299 } 289 }
300 290
301 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { 291 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const {
302 return true; 292 return true;
303 } 293 }
304 294
305 } // namespace extensions 295 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/content_scripts/policy/manifest.json ('k') | extensions/common/constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698