OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 enum UserGestureState { | 47 enum UserGestureState { |
48 USER_GESTURE_UNKNOWN = 0, | 48 USER_GESTURE_UNKNOWN = 0, |
49 USER_GESTURE_ENABLED = 1, | 49 USER_GESTURE_ENABLED = 1, |
50 USER_GESTURE_NOT_ENABLED = 2, | 50 USER_GESTURE_NOT_ENABLED = 2, |
51 }; | 51 }; |
52 | 52 |
53 // Observers register interest in events with a particular name and are | 53 // Observers register interest in events with a particular name and are |
54 // notified when a listener is added or removed for that |event_name|. | 54 // notified when a listener is added or removed for that |event_name|. |
55 class Observer { | 55 class Observer { |
56 public: | 56 public: |
57 virtual ~Observer() {} | |
58 | |
59 // Called when a listener is added. | 57 // Called when a listener is added. |
60 virtual void OnListenerAdded(const EventListenerInfo& details) {} | 58 virtual void OnListenerAdded(const EventListenerInfo& details) {} |
61 // Called when a listener is removed. | 59 // Called when a listener is removed. |
62 virtual void OnListenerRemoved(const EventListenerInfo& details) {} | 60 virtual void OnListenerRemoved(const EventListenerInfo& details) {} |
63 }; | 61 }; |
64 | 62 |
65 // Sends an event via ipc_sender to the given extension. Can be called on any | 63 // Sends an event via ipc_sender to the given extension. Can be called on any |
66 // thread. | 64 // thread. |
67 static void DispatchEvent(IPC::Sender* ipc_sender, | 65 static void DispatchEvent(IPC::Sender* ipc_sender, |
68 void* profile_id, | 66 void* profile_id, |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 EventListenerInfo(const std::string& event_name, | 302 EventListenerInfo(const std::string& event_name, |
305 const std::string& extension_id); | 303 const std::string& extension_id); |
306 | 304 |
307 const std::string event_name; | 305 const std::string event_name; |
308 const std::string extension_id; | 306 const std::string extension_id; |
309 }; | 307 }; |
310 | 308 |
311 } // namespace extensions | 309 } // namespace extensions |
312 | 310 |
313 #endif // CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ | 311 #endif // CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ |
OLD | NEW |