summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorrdevlin.cronin <rdevlin.cronin@chromium.org>2016-02-02 14:46:32 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-02 22:47:59 +0000
commit8d034e56507a74b9030f309455b325dbaeeb5c1c (patch)
tree744703a0185de21f5737483d5facac383a398bd9 /extensions
parent62351406cbe5712bf8c1c8a6a2307e18b25e4c53 (diff)
downloadchromium_src-8d034e56507a74b9030f309455b325dbaeeb5c1c.zip
chromium_src-8d034e56507a74b9030f309455b325dbaeeb5c1c.tar.gz
chromium_src-8d034e56507a74b9030f309455b325dbaeeb5c1c.tar.bz2
[Extensions] Wire up the ActiveScriptController for WebRequests
Add pieces in ActiveScriptController to handle web requests being blocked by click-to-script (--scripts-require-action). Right now, these are only stubs - the next patch will actually call them. BUG=460306 Review URL: https://codereview.chromium.org/1646133002 Cr-Commit-Position: refs/heads/master@{#373064}
Diffstat (limited to 'extensions')
-rw-r--r--extensions/browser/blocked_action_type.h21
-rw-r--r--extensions/common/extension_messages.h6
-rw-r--r--extensions/extensions.gypi1
-rw-r--r--extensions/renderer/script_injection.cc6
4 files changed, 29 insertions, 5 deletions
diff --git a/extensions/browser/blocked_action_type.h b/extensions/browser/blocked_action_type.h
new file mode 100644
index 0000000..4b008c0
--- /dev/null
+++ b/extensions/browser/blocked_action_type.h
@@ -0,0 +1,21 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_BLOCKED_ACTION_TYPE_H_
+#define EXTENSIONS_BROWSER_BLOCKED_ACTION_TYPE_H_
+
+namespace extensions {
+
+// Types of actions that an extension can perform that can be blocked (typically
+// while waiting for user action).
+enum BlockedActionType {
+ BLOCKED_ACTION_NONE = 0,
+ BLOCKED_ACTION_SCRIPT_AT_START = 1 << 0,
+ BLOCKED_ACTION_SCRIPT_OTHER = 1 << 1,
+ BLOCKED_ACTION_WEB_REQUEST = 1 << 2,
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_BLOCKED_ACTION_TYPE_H_
diff --git a/extensions/common/extension_messages.h b/extensions/common/extension_messages.h
index cadb33f..2e025ac 100644
--- a/extensions/common/extension_messages.h
+++ b/extensions/common/extension_messages.h
@@ -41,6 +41,9 @@ IPC_ENUM_TRAITS_MAX_VALUE(content::SocketPermissionRequest::OperationType,
IPC_ENUM_TRAITS_MAX_VALUE(extensions::UserScript::InjectionType,
extensions::UserScript::INJECTION_TYPE_LAST)
+IPC_ENUM_TRAITS_MAX_VALUE(extensions::UserScript::RunLocation,
+ extensions::UserScript::RUN_LOCATION_LAST - 1)
+
IPC_ENUM_TRAITS_MAX_VALUE(HostID::HostType, HostID::HOST_TYPE_LAST)
// Parameters structure for ExtensionHostMsg_AddAPIActionToActivityLog and
@@ -698,9 +701,10 @@ IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting,
// If request id is -1, this signals that the request has already ran, and this
// merely serves as a notification. This happens when the feature to disable
// scripts running without user consent is not enabled.
-IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestScriptInjectionPermission,
+IPC_MESSAGE_ROUTED4(ExtensionHostMsg_RequestScriptInjectionPermission,
std::string /* extension id */,
extensions::UserScript::InjectionType /* script type */,
+ extensions::UserScript::RunLocation /* run location */,
int64_t /* request id */)
// Sent from the browser to the renderer in reply to a
diff --git a/extensions/extensions.gypi b/extensions/extensions.gypi
index 4d285b8..d92bf49 100644
--- a/extensions/extensions.gypi
+++ b/extensions/extensions.gypi
@@ -531,6 +531,7 @@
'browser/blacklist_state.h',
'browser/blob_holder.cc',
'browser/blob_holder.h',
+ 'browser/blocked_action_type.h',
'browser/browser_context_keyed_api_factory.h',
'browser/browser_context_keyed_service_factories.cc',
'browser/browser_context_keyed_service_factories.h',
diff --git a/extensions/renderer/script_injection.cc b/extensions/renderer/script_injection.cc
index 2ab3c04..2606169 100644
--- a/extensions/renderer/script_injection.cc
+++ b/extensions/renderer/script_injection.cc
@@ -195,10 +195,8 @@ void ScriptInjection::RequestPermissionFromBrowser() {
// invalid request (which is treated like a notification).
request_id_ = g_next_pending_id++;
render_frame_->Send(new ExtensionHostMsg_RequestScriptInjectionPermission(
- render_frame_->GetRoutingID(),
- host_id().id(),
- injector_->script_type(),
- request_id_));
+ render_frame_->GetRoutingID(), host_id().id(), injector_->script_type(),
+ run_location_, request_id_));
}
void ScriptInjection::NotifyWillNotInject(