| 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/common/extension_messages.h" | 16 #include "extensions/common/extension_messages.h" |
| 16 #include "extensions/common/extension_set.h" | 17 #include "extensions/common/extension_set.h" |
| 17 #include "extensions/common/extensions_client.h" | 18 #include "extensions/common/extensions_client.h" |
| 18 #include "ui/base/webui/web_ui_util.h" | 19 #include "ui/base/webui/web_ui_util.h" |
| 19 | 20 |
| 20 using content::BrowserContext; | 21 using content::BrowserContext; |
| 21 | 22 |
| 22 namespace extensions { | 23 namespace extensions { |
| 23 | 24 |
| 24 RendererStartupHelper::RendererStartupHelper(BrowserContext* browser_context) | 25 RendererStartupHelper::RendererStartupHelper(BrowserContext* browser_context) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 49 // Valid extension function names, used to setup bindings in renderer. | 50 // Valid extension function names, used to setup bindings in renderer. |
| 50 std::vector<std::string> function_names; | 51 std::vector<std::string> function_names; |
| 51 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); | 52 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); |
| 52 process->Send(new ExtensionMsg_SetFunctionNames(function_names)); | 53 process->Send(new ExtensionMsg_SetFunctionNames(function_names)); |
| 53 | 54 |
| 54 // Scripting whitelist. This is modified by tests and must be communicated | 55 // Scripting whitelist. This is modified by tests and must be communicated |
| 55 // to renderers. | 56 // to renderers. |
| 56 process->Send(new ExtensionMsg_SetScriptingWhitelist( | 57 process->Send(new ExtensionMsg_SetScriptingWhitelist( |
| 57 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); | 58 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); |
| 58 | 59 |
| 60 // If the new render process is a WebView guest process, propagate the WebView |
| 61 // partition ID to it. |
| 62 std::string webview_partition_id = WebViewGuest::GetPartitionID(process); |
| 63 if (!webview_partition_id.empty()) { |
| 64 process->Send(new ExtensionMsg_SetWebViewPartitionID( |
| 65 WebViewGuest::GetPartitionID(process))); |
| 66 } |
| 67 |
| 59 // Loaded extensions. | 68 // Loaded extensions. |
| 60 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; | 69 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; |
| 61 const ExtensionSet& extensions = | 70 const ExtensionSet& extensions = |
| 62 ExtensionRegistry::Get(browser_context_)->enabled_extensions(); | 71 ExtensionRegistry::Get(browser_context_)->enabled_extensions(); |
| 63 for (const auto& ext : extensions) { | 72 for (const auto& ext : extensions) { |
| 64 // Renderers don't need to know about themes. | 73 // Renderers don't need to know about themes. |
| 65 if (!ext->is_theme()) { | 74 if (!ext->is_theme()) { |
| 66 // TODO(kalman): Only include tab specific permissions for extension | 75 // TODO(kalman): Only include tab specific permissions for extension |
| 67 // processes, no other process needs it, so it's mildly wasteful. | 76 // processes, no other process needs it, so it's mildly wasteful. |
| 68 // I am not sure this is possible to know this here, at such a low | 77 // I am not sure this is possible to know this here, at such a low |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 BrowserContext* context) const { | 116 BrowserContext* context) const { |
| 108 // Redirected in incognito. | 117 // Redirected in incognito. |
| 109 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 118 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
| 110 } | 119 } |
| 111 | 120 |
| 112 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { | 121 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { |
| 113 return true; | 122 return true; |
| 114 } | 123 } |
| 115 | 124 |
| 116 } // namespace extensions | 125 } // namespace extensions |
| OLD | NEW |