OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 UI_EVENTS_PLATFORM_PLATFORM_EVENT_SOURCE_H_ | 5 #ifndef UI_EVENTS_PLATFORM_PLATFORM_EVENT_SOURCE_H_ |
6 #define UI_EVENTS_PLATFORM_PLATFORM_EVENT_SOURCE_H_ | 6 #define UI_EVENTS_PLATFORM_PLATFORM_EVENT_SOURCE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 // The returned |ScopedEventDispatcher| object is a handler for the overridden | 40 // The returned |ScopedEventDispatcher| object is a handler for the overridden |
41 // dispatcher. When this handler is destroyed, it removes the overridden | 41 // dispatcher. When this handler is destroyed, it removes the overridden |
42 // dispatcher, and restores the previous override-dispatcher (or NULL if there | 42 // dispatcher, and restores the previous override-dispatcher (or NULL if there |
43 // wasn't any). | 43 // wasn't any). |
44 scoped_ptr<ScopedEventDispatcher> OverrideDispatcher( | 44 scoped_ptr<ScopedEventDispatcher> OverrideDispatcher( |
45 PlatformEventDispatcher* dispatcher); | 45 PlatformEventDispatcher* dispatcher); |
46 | 46 |
47 void AddPlatformEventObserver(PlatformEventObserver* observer); | 47 void AddPlatformEventObserver(PlatformEventObserver* observer); |
48 void RemovePlatformEventObserver(PlatformEventObserver* observer); | 48 void RemovePlatformEventObserver(PlatformEventObserver* observer); |
49 | 49 |
| 50 static scoped_ptr<PlatformEventSource> CreateDefault(); |
| 51 |
50 protected: | 52 protected: |
51 PlatformEventSource(); | 53 PlatformEventSource(); |
52 | 54 |
53 // Dispatches |platform_event| to the dispatchers. If there is an override | 55 // Dispatches |platform_event| to the dispatchers. If there is an override |
54 // dispatcher installed using |OverrideDispatcher()|, then that dispatcher | 56 // dispatcher installed using |OverrideDispatcher()|, then that dispatcher |
55 // receives the event first. |POST_DISPATCH_QUIT_LOOP| flag is set in the | 57 // receives the event first. |POST_DISPATCH_QUIT_LOOP| flag is set in the |
56 // returned value if the event-source should stop dispatching events at the | 58 // returned value if the event-source should stop dispatching events at the |
57 // current message-loop iteration. | 59 // current message-loop iteration. |
58 virtual uint32_t DispatchEvent(PlatformEvent platform_event); | 60 virtual uint32_t DispatchEvent(PlatformEvent platform_event); |
59 | 61 |
(...skipping 19 matching lines...) Expand all Loading... |
79 bool overridden_dispatcher_restored_; | 81 bool overridden_dispatcher_restored_; |
80 | 82 |
81 ObserverList<PlatformEventObserver> observers_; | 83 ObserverList<PlatformEventObserver> observers_; |
82 | 84 |
83 DISALLOW_COPY_AND_ASSIGN(PlatformEventSource); | 85 DISALLOW_COPY_AND_ASSIGN(PlatformEventSource); |
84 }; | 86 }; |
85 | 87 |
86 } // namespace ui | 88 } // namespace ui |
87 | 89 |
88 #endif // UI_EVENTS_PLATFORM_PLATFORM_EVENT_SOURCE_H_ | 90 #endif // UI_EVENTS_PLATFORM_PLATFORM_EVENT_SOURCE_H_ |
OLD | NEW |