OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_EVENTS_PLATFORM_PLATFORM_EVENT_OBSERVER_H_ |
| 6 #define UI_EVENTS_PLATFORM_PLATFORM_EVENT_OBSERVER_H_ |
| 7 |
| 8 #include "ui/events/events_export.h" |
| 9 #include "ui/events/platform/platform_event_types.h" |
| 10 |
| 11 namespace ui { |
| 12 |
| 13 // PlatformEventObserver can be installed on a PlatformEventSource, and it |
| 14 // receives all events that are dispatched to the dispatchers. |
| 15 class EVENTS_EXPORT PlatformEventObserver { |
| 16 public: |
| 17 enum EventStatus { |
| 18 EVENT_STATUS_CONTINUE, |
| 19 EVENT_STATUS_HANDLED |
| 20 }; |
| 21 |
| 22 // This is called before the dispatcher receives the event. The observer can |
| 23 // consume the event and stop the event from reaching the dispatcher or other |
| 24 // observers by returning EVENT_STATUS_HANDLED from this function. The event |
| 25 // dispatch continues as usual if this returns EVENT_STATUS_CONTINUE. |
| 26 virtual EventStatus WillProcessEvent(const PlatformEvent& event) = 0; |
| 27 |
| 28 // This is called after the event has been dispatched to the dispatcher(s). |
| 29 virtual void DidProcessEvent(const PlatformEvent& event) = 0; |
| 30 |
| 31 protected: |
| 32 virtual ~PlatformEventObserver() {} |
| 33 }; |
| 34 |
| 35 } // namespace ui |
| 36 |
| 37 #endif // UI_EVENTS_PLATFORM_PLATFORM_EVENT_OBSERVER_H_ |
OLD | NEW |