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 "ui/base/webui/web_ui_util.h" | 20 #include "ui/base/webui/web_ui_util.h" |
20 | 21 |
21 using content::BrowserContext; | 22 using content::BrowserContext; |
22 | 23 |
23 namespace extensions { | 24 namespace extensions { |
24 | 25 |
25 RendererStartupHelper::RendererStartupHelper(BrowserContext* browser_context) | 26 RendererStartupHelper::RendererStartupHelper(BrowserContext* browser_context) |
26 : browser_context_(browser_context) { | 27 : browser_context_(browser_context) { |
27 DCHECK(browser_context); | 28 DCHECK(browser_context); |
28 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 29 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
(...skipping 15 matching lines...) Expand all Loading... |
44 | 45 |
45 bool activity_logging_enabled = | 46 bool activity_logging_enabled = |
46 client->IsActivityLoggingEnabled(process->GetBrowserContext()); | 47 client->IsActivityLoggingEnabled(process->GetBrowserContext()); |
47 // We only send the ActivityLoggingEnabled message if it is enabled; otherwise | 48 // We only send the ActivityLoggingEnabled message if it is enabled; otherwise |
48 // the default (not enabled) is correct. | 49 // the default (not enabled) is correct. |
49 if (activity_logging_enabled) { | 50 if (activity_logging_enabled) { |
50 process->Send( | 51 process->Send( |
51 new ExtensionMsg_SetActivityLoggingEnabled(activity_logging_enabled)); | 52 new ExtensionMsg_SetActivityLoggingEnabled(activity_logging_enabled)); |
52 } | 53 } |
53 | 54 |
| 55 // Extensions need to know the channel for API restrictions. Send the channel |
| 56 // to all renderers, as the non-extension renderers may have content scripts. |
| 57 process->Send(new ExtensionMsg_SetChannel(GetCurrentChannel())); |
| 58 |
54 // Platform apps need to know the system font. | 59 // Platform apps need to know the system font. |
55 // TODO(dbeam): this is not the system font in all cases. | 60 // TODO(dbeam): this is not the system font in all cases. |
56 process->Send(new ExtensionMsg_SetSystemFont(webui::GetFontFamily(), | 61 process->Send(new ExtensionMsg_SetSystemFont(webui::GetFontFamily(), |
57 webui::GetFontSize())); | 62 webui::GetFontSize())); |
58 | 63 |
59 // Scripting whitelist. This is modified by tests and must be communicated | 64 // Scripting whitelist. This is modified by tests and must be communicated |
60 // to renderers. | 65 // to renderers. |
61 process->Send(new ExtensionMsg_SetScriptingWhitelist( | 66 process->Send(new ExtensionMsg_SetScriptingWhitelist( |
62 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); | 67 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); |
63 | 68 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 BrowserContext* context) const { | 125 BrowserContext* context) const { |
121 // Redirected in incognito. | 126 // Redirected in incognito. |
122 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 127 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
123 } | 128 } |
124 | 129 |
125 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { | 130 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { |
126 return true; | 131 return true; |
127 } | 132 } |
128 | 133 |
129 } // namespace extensions | 134 } // namespace extensions |
OLD | NEW |