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 "extensions/common/features/feature_channel.h" |
20 #include "extensions/common/features/feature_session_type.h" | |
20 #include "ui/base/webui/web_ui_util.h" | 21 #include "ui/base/webui/web_ui_util.h" |
21 | 22 |
22 using content::BrowserContext; | 23 using content::BrowserContext; |
23 | 24 |
24 namespace extensions { | 25 namespace extensions { |
25 | 26 |
26 RendererStartupHelper::RendererStartupHelper(BrowserContext* browser_context) | 27 RendererStartupHelper::RendererStartupHelper(BrowserContext* browser_context) |
27 : browser_context_(browser_context) { | 28 : browser_context_(browser_context) { |
28 DCHECK(browser_context); | 29 DCHECK(browser_context); |
29 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 30 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 // the default (not enabled) is correct. | 64 // the default (not enabled) is correct. |
64 if (activity_logging_enabled) { | 65 if (activity_logging_enabled) { |
65 process->Send( | 66 process->Send( |
66 new ExtensionMsg_SetActivityLoggingEnabled(activity_logging_enabled)); | 67 new ExtensionMsg_SetActivityLoggingEnabled(activity_logging_enabled)); |
67 } | 68 } |
68 | 69 |
69 // Extensions need to know the channel for API restrictions. Send the channel | 70 // Extensions need to know the channel for API restrictions. Send the channel |
70 // to all renderers, as the non-extension renderers may have content scripts. | 71 // to all renderers, as the non-extension renderers may have content scripts. |
71 process->Send(new ExtensionMsg_SetChannel(GetCurrentChannel())); | 72 process->Send(new ExtensionMsg_SetChannel(GetCurrentChannel())); |
72 | 73 |
74 // Extensions need to know the session type for API restrictions. The session | |
75 // type is determined based on the user for which the current session is | |
Devlin
2016/08/18 17:19:15
omit "The session type is determined..." - that's
| |
76 // started. | |
77 // The value is sent to all renderers, as the non-extension renderers may have | |
78 // content scripts. | |
79 process->Send( | |
Devlin
2016/08/18 17:19:15
IPCs aren't free, and I think it's probably cheape
| |
80 new ExtensionMsg_SetUserSessionType(GetCurrentFeatureSessionType())); | |
81 | |
73 // Platform apps need to know the system font. | 82 // Platform apps need to know the system font. |
74 // TODO(dbeam): this is not the system font in all cases. | 83 // TODO(dbeam): this is not the system font in all cases. |
75 process->Send(new ExtensionMsg_SetSystemFont(webui::GetFontFamily(), | 84 process->Send(new ExtensionMsg_SetSystemFont(webui::GetFontFamily(), |
76 webui::GetFontSize())); | 85 webui::GetFontSize())); |
77 | 86 |
78 // Scripting whitelist. This is modified by tests and must be communicated | 87 // Scripting whitelist. This is modified by tests and must be communicated |
79 // to renderers. | 88 // to renderers. |
80 process->Send(new ExtensionMsg_SetScriptingWhitelist( | 89 process->Send(new ExtensionMsg_SetScriptingWhitelist( |
81 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); | 90 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); |
82 | 91 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 BrowserContext* context) const { | 210 BrowserContext* context) const { |
202 // Redirected in incognito. | 211 // Redirected in incognito. |
203 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 212 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
204 } | 213 } |
205 | 214 |
206 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { | 215 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { |
207 return true; | 216 return true; |
208 } | 217 } |
209 | 218 |
210 } // namespace extensions | 219 } // namespace extensions |
OLD | NEW |