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

Unified Diff: extensions/renderer/dispatcher.cc

Issue 2241203003: Pass user session type to extension feature checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split out some stuff 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 side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/dispatcher.cc
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index 27979f922e75cd6199efcf077c8a6d43b2e94bf3..02b638c6e280f43b53fff3189626acec0e475eb0 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -213,7 +213,8 @@ Dispatcher::Dispatcher(DispatcherDelegate* delegate)
v8_schema_registry_(new V8SchemaRegistry),
user_script_set_manager_observer_(this),
webrequest_used_(false),
- activity_logging_enabled_(false) {
+ activity_logging_enabled_(false),
+ session_type_(Feature::SESSION_TYPE_UNSPECIFIED) {
const base::CommandLine& command_line =
*(base::CommandLine::ForCurrentProcess());
set_idle_notifications_ =
@@ -319,7 +320,7 @@ void Dispatcher::DidCreateScriptContext(
const base::TimeTicks start_time = base::TimeTicks::Now();
ScriptContext* context = script_context_set_->Register(
- frame, v8_context, extension_group, world_id);
+ frame, v8_context, session_type_, extension_group, world_id);
// Initialize origin permissions for content scripts, which can't be
// initialized in |OnActivateExtension|.
@@ -439,7 +440,7 @@ void Dispatcher::DidInitializeServiceWorkerContextOnWorkerThread(
ScriptContext* context = new ScriptContext(
v8_context, nullptr, extension, Feature::SERVICE_WORKER_CONTEXT,
- extension, Feature::SERVICE_WORKER_CONTEXT);
+ session_type_, extension, Feature::SERVICE_WORKER_CONTEXT);
context->set_url(url);
if (ExtensionsClient::Get()->ExtensionAPIEnabledInExtensionServiceWorkers()) {
@@ -956,6 +957,7 @@ bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ExtensionMsg_UsingWebRequestAPI, OnUsingWebRequestAPI)
IPC_MESSAGE_HANDLER(ExtensionMsg_SetActivityLoggingEnabled,
OnSetActivityLoggingEnabled)
+ IPC_MESSAGE_HANDLER(ExtensionMsg_SetUserSessionType, OnSetUserSessionType)
IPC_MESSAGE_FORWARD(ExtensionMsg_WatchPages,
content_watcher_.get(),
ContentWatcher::OnWatchPages)
@@ -1282,6 +1284,10 @@ void Dispatcher::OnSetActivityLoggingEnabled(bool enabled) {
user_script_set_manager_->set_activity_logging_enabled(enabled);
}
+void Dispatcher::OnSetUserSessionType(Feature::SessionType session_type) {
+ session_type_ = session_type;
+}
+
void Dispatcher::OnUserScriptsUpdated(const std::set<HostID>& changed_hosts) {
UpdateActiveExtensions();
}

Powered by Google App Engine
This is Rietveld 408576698