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

Unified Diff: base/message_pump_observer.h

Issue 8021009: Consolidate message observer API for win and aura (and touch). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years, 3 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
Index: base/message_pump_observer.h
diff --git a/base/message_pump_observer.h b/base/message_pump_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..d12f2211c4fc9f4e175d86fbbb45eef5a9e23064
--- /dev/null
+++ b/base/message_pump_observer.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2011 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 BASE_MESSAGE_PUMP_OBSERVER_H
+#define BASE_MESSAGE_PUMP_OBSERVER_H
+
+#if defined(USE_X11)
+typedef union _XEvent XEvent;
+#endif
+
+namespace base {
+
+#if defined(OS_WIN)
+typedef MSG NativeEvent;
+#elif defined(USE_X11)
+typedef XEvent* NativeEvent;
+#endif
+
+enum EventStatus {
+ EVENT_CONTINUE, // The event should be dispatched as normal.
+#if defined(USE_X11)
+ EVENT_HANDLED // The event should not be processed any farther.
+#endif
+};
+
+// A MessagePumpObserver is an object that receives global
+// notifications from the UI MessageLoop with MessagePumpWin or
+// MessagePumpX.
+//
+// NOTE: An Observer implementation should be extremely fast!
+//
+// For use with MessagePumpX, please see message_pump_glib.h for more
+// info about how this is invoked in this environment.
+class BASE_EXPORT MessagePumpObserver {
+ public:
+ // This method is called before processing a NativeEvent. If the
+ // method returns EVENT_HANDLED, it indicates the event has already
+ // been handled, so the event is not processed any farther. If the
+ // method returns EVENT_CONTINUE, the event dispatching proceeds as
+ // normal.
+ virtual EventStatus WillProcessEvent(const NativeEvent& event) = 0;
+
+ // This method is called after processing a message. This method
+ // will not be called if WillProcessEvent returns EVENT_HANDLED.
+ virtual void DidProcessEvent(const NativeEvent& event) = 0;
+
+ protected:
+ virtual ~MessagePumpObserver() {}
+};
+
+} // namespace base
+
+#endif // BASE_MESSAGE_PUMP_OBSERVER_VIEWS_H
« no previous file with comments | « base/message_loop.h ('k') | base/message_pump_win.h » ('j') | views/widget/native_widget_gtk.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698