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

Unified Diff: chrome/browser/extensions/extension_event_router.h

Issue 9316102: Update extension events, routing, and delivery to use user gesture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: lint fix Created 8 years, 10 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: chrome/browser/extensions/extension_event_router.h
diff --git a/chrome/browser/extensions/extension_event_router.h b/chrome/browser/extensions/extension_event_router.h
index 80e6df002724dbaee42585a1aa6ed6fade3a7665..bfaa1ea2d3acae784d68b7e7ccbe31dfafb2331d 100644
--- a/chrome/browser/extensions/extension_event_router.h
+++ b/chrome/browser/extensions/extension_event_router.h
@@ -28,13 +28,22 @@ class RenderProcessHost;
class ExtensionEventRouter : public content::NotificationObserver {
public:
+ // These constants convey the state of our knowledge of whether we're in
+ // a user-caused gesture as part of DispatchEvent.
+ enum UserGestureState {
+ USER_GESTURE_UNKNOWN = 0,
+ USER_GESTURE_ENABLED = 1,
+ USER_GESTURE_NOT_ENABLED = 2,
+ };
+
// Sends an event via ipc_sender to the given extension. Can be called on
// any thread.
static void DispatchEvent(IPC::Message::Sender* ipc_sender,
const std::string& extension_id,
const std::string& event_name,
const std::string& event_args,
- const GURL& event_url);
+ const GURL& event_url,
+ UserGestureState user_gesture);
explicit ExtensionEventRouter(Profile* profile);
virtual ~ExtensionEventRouter();
@@ -86,6 +95,16 @@ class ExtensionEventRouter : public content::NotificationObserver {
Profile* restrict_to_profile,
const GURL& event_url);
+ // Dispatch an event to particular extension. Also include an
+ // explicit user gesture indicator.
+ virtual void DispatchEventToExtension(
+ const std::string& extension_id,
+ const std::string& event_name,
+ const std::string& event_args,
+ Profile* restrict_to_profile,
+ const GURL& event_url,
+ UserGestureState user_gesture);
+
// Send different versions of an event to extensions in different profiles.
// This is used in the case of sending one event to extensions that have
// incognito access, and another event to extensions that don't (here),
« no previous file with comments | « chrome/browser/extensions/api/webrequest/webrequest_api.cc ('k') | chrome/browser/extensions/extension_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698