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 29 matching lines...) Expand all Loading... | |
59 | 60 |
60 bool activity_logging_enabled = | 61 bool activity_logging_enabled = |
61 client->IsActivityLoggingEnabled(process->GetBrowserContext()); | 62 client->IsActivityLoggingEnabled(process->GetBrowserContext()); |
62 // We only send the ActivityLoggingEnabled message if it is enabled; otherwise | 63 // We only send the ActivityLoggingEnabled message if it is enabled; otherwise |
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 and the session type for API |
70 // to all renderers, as the non-extension renderers may have content scripts. | 71 // restrictions. The values are sent to all renderers, as the non-extension |
71 process->Send(new ExtensionMsg_SetChannel(GetCurrentChannel())); | 72 // renderers may have content scripts. |
73 process->Send(new ExtensionMsg_SetSessionInfo( | |
74 GetCurrentChannel(), GetCurrentFeatureSessionType())); | |
Devlin
2016/08/19 00:43:28
I'm not familiar with where the login flow might h
tbarzic
2016/08/19 17:23:32
It's done during profile creation, so it should be
| |
72 | 75 |
73 // Platform apps need to know the system font. | 76 // Platform apps need to know the system font. |
74 // TODO(dbeam): this is not the system font in all cases. | 77 // TODO(dbeam): this is not the system font in all cases. |
75 process->Send(new ExtensionMsg_SetSystemFont(webui::GetFontFamily(), | 78 process->Send(new ExtensionMsg_SetSystemFont(webui::GetFontFamily(), |
76 webui::GetFontSize())); | 79 webui::GetFontSize())); |
77 | 80 |
78 // Scripting whitelist. This is modified by tests and must be communicated | 81 // Scripting whitelist. This is modified by tests and must be communicated |
79 // to renderers. | 82 // to renderers. |
80 process->Send(new ExtensionMsg_SetScriptingWhitelist( | 83 process->Send(new ExtensionMsg_SetScriptingWhitelist( |
81 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); | 84 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 BrowserContext* context) const { | 204 BrowserContext* context) const { |
202 // Redirected in incognito. | 205 // Redirected in incognito. |
203 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 206 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
204 } | 207 } |
205 | 208 |
206 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { | 209 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { |
207 return true; | 210 return true; |
208 } | 211 } |
209 | 212 |
210 } // namespace extensions | 213 } // namespace extensions |
OLD | NEW |