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 |
57 // Called when a listener is added. | 59 // Called when a listener is added. |
58 virtual void OnListenerAdded(const EventListenerInfo& details) {} | 60 virtual void OnListenerAdded(const EventListenerInfo& details) {} |
59 // Called when a listener is removed. | 61 // Called when a listener is removed. |
60 virtual void OnListenerRemoved(const EventListenerInfo& details) {} | 62 virtual void OnListenerRemoved(const EventListenerInfo& details) {} |
61 }; | 63 }; |
62 | 64 |
63 // Sends an event via ipc_sender to the given extension. Can be called on any | 65 // Sends an event via ipc_sender to the given extension. Can be called on any |
64 // thread. | 66 // thread. |
65 static void DispatchEvent(IPC::Sender* ipc_sender, | 67 static void DispatchEvent(IPC::Sender* ipc_sender, |
66 void* profile_id, | 68 void* profile_id, |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 EventListenerInfo(const std::string& event_name, | 304 EventListenerInfo(const std::string& event_name, |
303 const std::string& extension_id); | 305 const std::string& extension_id); |
304 | 306 |
305 const std::string event_name; | 307 const std::string event_name; |
306 const std::string extension_id; | 308 const std::string extension_id; |
307 }; | 309 }; |
308 | 310 |
309 } // namespace extensions | 311 } // namespace extensions |
310 | 312 |
311 #endif // CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ | 313 #endif // CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ |
OLD | NEW |