OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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 BASE_MESSAGE_PUMP_DISPATCHER_H | |
6 #define BASE_MESSAGE_PUMP_DISPATCHER_H | |
7 #pragma once | |
8 | |
9 #include "base/base_export.h" | |
10 #include "base/event_types.h" | |
11 | |
12 namespace base { | |
13 | |
14 enum DispatchStatus { | |
15 #if defined(USE_X11) | |
16 EVENT_IGNORED, // The event was not processed. Used to handle gesture. | |
17 // TODO(oshima|sadrul): Eliminate this enum and just use | |
18 // bool once crbug.com/112329 is done. | |
19 #endif | |
20 EVENT_PROCESSED, // The event has been processed. | |
21 EVENT_QUIT // The event was processed and the message-loop should | |
22 // terminate. | |
23 }; | |
24 | |
25 // Dispatcher is used during a nested invocation of Run to dispatch | |
26 // events when |MessageLoop::RunWithDispatcher| is invoked. If | |
27 // |MessageLoop::Run| is invoked, MessageLoop does not dispatch events | |
28 // (or invoke TranslateMessage), rather every message is passed to | |
29 // Dispatcher's Dispatch method for dispatch. It is up to the | |
30 // Dispatcher to dispatch, or not, the event. | |
31 // | |
32 // The nested loop is exited by either posting a quit, or returning EVENT_QUIT | |
33 // from Dispatch. | |
34 class BASE_EXPORT MessagePumpDispatcher { | |
35 public: | |
36 virtual ~MessagePumpDispatcher() {} | |
37 | |
38 // Dispatches the event. EVENT_IGNORED is returned if the event was | |
39 // ignored (i.e. not processed. X11 only). EVENT_PROCESSED is | |
40 // returned if the event was processed. The nested loop exits | |
41 // immediately if EVENT_QUIT is returned. | |
42 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-
| |
43 }; | |
44 | |
45 } // namespace base | |
46 | |
47 #endif // BASE_MESSAGE_PUMP_DISPATCHER_H | |
OLD | NEW |