| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 enum UserGestureState { | 46 enum UserGestureState { |
| 47 USER_GESTURE_UNKNOWN = 0, | 47 USER_GESTURE_UNKNOWN = 0, |
| 48 USER_GESTURE_ENABLED = 1, | 48 USER_GESTURE_ENABLED = 1, |
| 49 USER_GESTURE_NOT_ENABLED = 2, | 49 USER_GESTURE_NOT_ENABLED = 2, |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // Observers register interest in events with a particular name and are | 52 // Observers register interest in events with a particular name and are |
| 53 // notified when a listener is added or removed for that |event_name|. | 53 // notified when a listener is added or removed for that |event_name|. |
| 54 class Observer { | 54 class Observer { |
| 55 public: | 55 public: |
| 56 virtual ~Observer() {} |
| 57 |
| 56 // Called when a listener is added. | 58 // Called when a listener is added. |
| 57 virtual void OnListenerAdded(const EventListenerInfo& details) {} | 59 virtual void OnListenerAdded(const EventListenerInfo& details) {} |
| 58 // Called when a listener is removed. | 60 // Called when a listener is removed. |
| 59 virtual void OnListenerRemoved(const EventListenerInfo& details) {} | 61 virtual void OnListenerRemoved(const EventListenerInfo& details) {} |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 // Sends an event via ipc_sender to the given extension. Can be called on any | 64 // Sends an event via ipc_sender to the given extension. Can be called on any |
| 63 // thread. | 65 // thread. |
| 64 static void DispatchEvent(IPC::Sender* ipc_sender, | 66 static void DispatchEvent(IPC::Sender* ipc_sender, |
| 65 const std::string& extension_id, | 67 const std::string& extension_id, |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 EventListenerInfo(const std::string& event_name, | 292 EventListenerInfo(const std::string& event_name, |
| 291 const std::string& extension_id); | 293 const std::string& extension_id); |
| 292 | 294 |
| 293 const std::string event_name; | 295 const std::string event_name; |
| 294 const std::string extension_id; | 296 const std::string extension_id; |
| 295 }; | 297 }; |
| 296 | 298 |
| 297 } // namespace extensions | 299 } // namespace extensions |
| 298 | 300 |
| 299 #endif // CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ | 301 #endif // CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ |
| OLD | NEW |