Index: base/message_pump_dispatcher.h |
diff --git a/base/message_pump_dispatcher.h b/base/message_pump_dispatcher.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6cc317c4151f1c6ef2308429a936921eecfd59e9 |
--- /dev/null |
+++ b/base/message_pump_dispatcher.h |
@@ -0,0 +1,47 @@ |
+// Copyright (c) 2012 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_DISPATCHER_H |
+#define BASE_MESSAGE_PUMP_DISPATCHER_H |
+#pragma once |
+ |
+#include "base/base_export.h" |
+#include "base/event_types.h" |
+ |
+namespace base { |
+ |
+enum DispatchStatus { |
+#if defined(USE_X11) |
+ EVENT_IGNORED, // The event was not processed. Used to handle gesture. |
+ // TODO(oshima|sadrul): Eliminate this enum and just use |
+ // bool once crbug.com/112329 is done. |
+#endif |
+ EVENT_PROCESSED, // The event has been processed. |
+ EVENT_QUIT // The event was processed and the message-loop should |
+ // terminate. |
+}; |
+ |
+// Dispatcher is used during a nested invocation of Run to dispatch |
+// events when |MessageLoop::RunWithDispatcher| is invoked. If |
+// |MessageLoop::Run| is invoked, MessageLoop does not dispatch events |
+// (or invoke TranslateMessage), rather every message is passed to |
+// Dispatcher's Dispatch method for dispatch. It is up to the |
+// Dispatcher to dispatch, or not, the event. |
+// |
+// The nested loop is exited by either posting a quit, or returning EVENT_QUIT |
+// from Dispatch. |
+class BASE_EXPORT MessagePumpDispatcher { |
+ public: |
+ virtual ~MessagePumpDispatcher() {} |
+ |
+ // Dispatches the event. EVENT_IGNORED is returned if the event was |
+ // ignored (i.e. not processed. X11 only). EVENT_PROCESSED is |
+ // returned if the event was processed. The nested loop exits |
+ // immediately if EVENT_QUIT is returned. |
+ virtual DispatchStatus Dispatch(const NativeEvent& event) = 0; |
darin (slow to review)
2012/04/05 20:21:09
it seems like there are really two flags here:
1-
|
+}; |
+ |
+} // namespace base |
+ |
+#endif // BASE_MESSAGE_PUMP_DISPATCHER_H |