| 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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 RendererStartupHelper::~RendererStartupHelper() {} | 32 RendererStartupHelper::~RendererStartupHelper() {} |
| 33 | 33 |
| 34 void RendererStartupHelper::Observe( | 34 void RendererStartupHelper::Observe( |
| 35 int type, | 35 int type, |
| 36 const content::NotificationSource& source, | 36 const content::NotificationSource& source, |
| 37 const content::NotificationDetails& details) { | 37 const content::NotificationDetails& details) { |
| 38 DCHECK_EQ(content::NOTIFICATION_RENDERER_PROCESS_CREATED, type); | 38 DCHECK_EQ(content::NOTIFICATION_RENDERER_PROCESS_CREATED, type); |
| 39 content::RenderProcessHost* process = | 39 content::RenderProcessHost* process = |
| 40 content::Source<content::RenderProcessHost>(source).ptr(); | 40 content::Source<content::RenderProcessHost>(source).ptr(); |
| 41 if (!ExtensionsBrowserClient::Get()->IsSameContext( | 41 ExtensionsBrowserClient* client = ExtensionsBrowserClient::Get(); |
| 42 browser_context_, process->GetBrowserContext())) | 42 if (!client->IsSameContext(browser_context_, process->GetBrowserContext())) |
| 43 return; | 43 return; |
| 44 | 44 |
| 45 bool activity_logging_enabled = |
| 46 client->IsActivityLoggingEnabled(process->GetBrowserContext()); |
| 47 // We only send the ActivityLoggingEnabled message if it is enabled; otherwise |
| 48 // the default (not enabled) is correct. |
| 49 if (activity_logging_enabled) { |
| 50 process->Send( |
| 51 new ExtensionMsg_SetActivityLoggingEnabled(activity_logging_enabled)); |
| 52 } |
| 53 |
| 45 // Platform apps need to know the system font. | 54 // Platform apps need to know the system font. |
| 46 // TODO(dbeam): this is not the system font in all cases. | 55 // TODO(dbeam): this is not the system font in all cases. |
| 47 process->Send(new ExtensionMsg_SetSystemFont(webui::GetFontFamily(), | 56 process->Send(new ExtensionMsg_SetSystemFont(webui::GetFontFamily(), |
| 48 webui::GetFontSize())); | 57 webui::GetFontSize())); |
| 49 | 58 |
| 50 // Scripting whitelist. This is modified by tests and must be communicated | 59 // Scripting whitelist. This is modified by tests and must be communicated |
| 51 // to renderers. | 60 // to renderers. |
| 52 process->Send(new ExtensionMsg_SetScriptingWhitelist( | 61 process->Send(new ExtensionMsg_SetScriptingWhitelist( |
| 53 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); | 62 extensions::ExtensionsClient::Get()->GetScriptingWhitelist())); |
| 54 | 63 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 BrowserContext* context) const { | 120 BrowserContext* context) const { |
| 112 // Redirected in incognito. | 121 // Redirected in incognito. |
| 113 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 122 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
| 114 } | 123 } |
| 115 | 124 |
| 116 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { | 125 bool RendererStartupHelperFactory::ServiceIsCreatedWithBrowserContext() const { |
| 117 return true; | 126 return true; |
| 118 } | 127 } |
| 119 | 128 |
| 120 } // namespace extensions | 129 } // namespace extensions |
| OLD | NEW |