Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: ui/events/platform/platform_event_observer.h

Issue 203483004: events: Introduce PlatformEventDispatcher and PlatformEventSource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/platform/platform_event_dispatcher.h ('k') | ui/events/platform/platform_event_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bde2733552c42a29b093acb60de8f41787c80db5
--- /dev/null
+++ b/ui/events/platform/platform_event_observer.h
@@ -0,0 +1,37 @@
+// 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:
+ enum EventStatus {
+ EVENT_STATUS_CONTINUE,
+ EVENT_STATUS_HANDLED
+ };
+
+ // 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 EVENT_STATUS_HANDLED from this function. The event
+ // dispatch continues as usual if this returns EVENT_STATUS_CONTINUE.
+ virtual EventStatus 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;
+
+ protected:
+ virtual ~PlatformEventObserver() {}
+};
+
+} // namespace ui
+
+#endif // UI_EVENTS_PLATFORM_PLATFORM_EVENT_OBSERVER_H_
« no previous file with comments | « ui/events/platform/platform_event_dispatcher.h ('k') | ui/events/platform/platform_event_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698