Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Side by Side Diff: extensions/browser/renderer_startup_helper.cc

Issue 2241203003: Pass user session type to extension feature checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/extension_util.h"
14 #include "extensions/browser/extensions_browser_client.h" 15 #include "extensions/browser/extensions_browser_client.h"
15 #include "extensions/browser/guest_view/web_view/web_view_guest.h" 16 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
16 #include "extensions/common/extension_messages.h" 17 #include "extensions/common/extension_messages.h"
17 #include "extensions/common/extension_set.h" 18 #include "extensions/common/extension_set.h"
18 #include "extensions/common/extensions_client.h" 19 #include "extensions/common/extensions_client.h"
19 #include "extensions/common/features/feature_channel.h" 20 #include "extensions/common/features/feature_channel.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
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
76 // started.
77 // The value is sent to all renderers, as the non-extension renderers may have
78 // content scripts.
79 process->Send(new ExtensionMsg_SetUserSessionType(
80 extensions::util::GetCurrentSessionType()));
rkc 2016/08/17 23:07:24 This can be GetCurrentFeatureSessionType() instead
tbarzic 2016/08/18 01:05:33 Done.
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698