| 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 19 matching lines...) Expand all Loading... |
| 44 // Platform apps need to know the system font. | 45 // Platform apps need to know the system font. |
| 45 // TODO(dbeam): this is not the system font in all cases. | 46 // TODO(dbeam): this is not the system font in all cases. |
| 46 process->Send(new ExtensionMsg_SetSystemFont(webui::GetFontFamily(), | 47 process->Send(new ExtensionMsg_SetSystemFont(webui::GetFontFamily(), |
| 47 webui::GetFontSize())); | 48 webui::GetFontSize())); |
| 48 | 49 |
| 49 // Scripting whitelist. This is modified by tests and must be communicated | 50 // Scripting whitelist. This is modified by tests and must be communicated |
| 50 // to renderers. | 51 // to renderers. |
| 51 process->Send(new ExtensionMsg_SetScriptingWhitelist( | 52 process->Send(new ExtensionMsg_SetScriptingWhitelist( |
| 52 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); | 53 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); |
| 53 | 54 |
| 55 // If the new render process is a WebView guest process, propagate the WebView |
| 56 // partition ID to it. |
| 57 std::string webview_partition_id = WebViewGuest::GetPartitionID(process); |
| 58 if (!webview_partition_id.empty()) { |
| 59 process->Send(new ExtensionMsg_SetWebViewPartitionID( |
| 60 WebViewGuest::GetPartitionID(process))); |
| 61 } |
| 62 |
| 54 // Loaded extensions. | 63 // Loaded extensions. |
| 55 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; | 64 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; |
| 56 const ExtensionSet& extensions = | 65 const ExtensionSet& extensions = |
| 57 ExtensionRegistry::Get(browser_context_)->enabled_extensions(); | 66 ExtensionRegistry::Get(browser_context_)->enabled_extensions(); |
| 58 for (const auto& ext : extensions) { | 67 for (const auto& ext : extensions) { |
| 59 // Renderers don't need to know about themes. | 68 // Renderers don't need to know about themes. |
| 60 if (!ext->is_theme()) { | 69 if (!ext->is_theme()) { |
| 61 // TODO(kalman): Only include tab specific permissions for extension | 70 // TODO(kalman): Only include tab specific permissions for extension |
| 62 // processes, no other process needs it, so it's mildly wasteful. | 71 // processes, no other process needs it, so it's mildly wasteful. |
| 63 // I am not sure this is possible to know this here, at such a low | 72 // 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... |
| 102 BrowserContext* context) const { | 111 BrowserContext* context) const { |
| 103 // Redirected in incognito. | 112 // Redirected in incognito. |
| 104 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 113 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
| 105 } | 114 } |
| 106 | 115 |
| 107 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { | 116 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { |
| 108 return true; | 117 return true; |
| 109 } | 118 } |
| 110 | 119 |
| 111 } // namespace extensions | 120 } // namespace extensions |
| OLD | NEW |