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

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: Merge to head 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 daef5543e4f0e983d392206dcb0f9b3693fb7249..3b777fd87ce56acb956c2a1706ae6ea33bb66618 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 UserGesture {
Aaron Boodman 2012/02/29 01:20:37 Naming suggestion: UserGestureState?
Greg Billock 2012/02/29 17:58:08 Done.
+ kUnknownUserGesture = 0,
Aaron Boodman 2012/02/29 01:20:37 according to the style guide (http://www.chromium.
Greg Billock 2012/02/29 17:58:08 I'd read this: "Though the style guide says to use
+ kIsUserGesture = 1,
+ kIsNotUserGesture = 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,
+ UserGesture 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,
+ UserGesture 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),

Powered by Google App Engine
This is Rietveld 408576698