Chromium Code Reviews| Index: ui/events/platform/platform_event_observer.h |
| diff --git a/ui/events/platform/platform_event_observer.h b/ui/events/platform/platform_event_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..50cdd2dacf5773ab64e6c5deafc7f866208b9e54 |
| --- /dev/null |
| +++ b/ui/events/platform/platform_event_observer.h |
| @@ -0,0 +1,31 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_EVENTS_PLATFORM_PLATFORM_EVENT_OBSERVER_H_ |
| +#define UI_EVENTS_PLATFORM_PLATFORM_EVENT_OBSERVER_H_ |
| + |
| +#include "ui/events/events_export.h" |
| +#include "ui/events/platform/platform_event_types.h" |
| + |
| +namespace ui { |
| + |
| +// PlatformEventObserver can be installed on a PlatformEventSource, and it |
| +// receives all events that are dispatched to the dispatchers. |
| +class EVENTS_EXPORT PlatformEventObserver { |
| + public: |
| + virtual ~PlatformEventObserver() {} |
|
sky
2014/03/25 15:51:15
protected?
sadrul
2014/03/25 18:33:15
Done.
|
| + |
| + // This is called before the dispatcher receives the event. The observer can |
| + // consume the event and stop the event from reaching the dispatcher or other |
| + // observers by returning true from this function. The event dispatch |
|
sky
2014/03/25 15:51:15
nit: I think an enum would be cleaner here.
sadrul
2014/03/25 18:33:15
Done.
|
| + // continues as usual if this returns false. |
| + virtual bool WillProcessEvent(const PlatformEvent& event) = 0; |
| + |
| + // This is called after the event has been dispatched to the dispatcher(s). |
| + virtual void DidProcessEvent(const PlatformEvent& event) = 0; |
| +}; |
| + |
| +} // namespace ui |
| + |
| +#endif // UI_EVENTS_PLATFORM_PLATFORM_EVENT_OBSERVER_H_ |