| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_MESSAGE_PUMP_DISPATCHER_H | 5 #ifndef BASE_MESSAGE_PUMP_DISPATCHER_H |
| 6 #define BASE_MESSAGE_PUMP_DISPATCHER_H | 6 #define BASE_MESSAGE_PUMP_DISPATCHER_H |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/base_export.h" | 9 #include "base/base_export.h" |
| 10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 | 13 |
| 14 // Dispatcher is used during a nested invocation of Run to dispatch | 14 // Dispatcher is used during a nested invocation of Run to dispatch events when |
| 15 // events when |MessageLoop::RunWithDispatcher| is invoked. If | 15 // |RunLoop(dispatcher).Run()| is used. If |RunLoop().Run()| is invoked, |
| 16 // |MessageLoop::Run| is invoked, MessageLoop does not dispatch events | 16 // MessageLoop does not dispatch events (or invoke TranslateMessage), rather |
| 17 // (or invoke TranslateMessage), rather every message is passed to | 17 // every message is passed to Dispatcher's Dispatch method for dispatch. It is |
| 18 // Dispatcher's Dispatch method for dispatch. It is up to the | 18 // up to the Dispatcher whether or not to dispatch the event. |
| 19 // Dispatcher whether or not to dispatch the event. | |
| 20 // | 19 // |
| 21 // The nested loop is exited by either posting a quit, or returning false | 20 // The nested loop is exited by either posting a quit, or returning false |
| 22 // from Dispatch. | 21 // from Dispatch. |
| 23 class BASE_EXPORT MessagePumpDispatcher { | 22 class BASE_EXPORT MessagePumpDispatcher { |
| 24 public: | 23 public: |
| 25 virtual ~MessagePumpDispatcher() {} | 24 virtual ~MessagePumpDispatcher() {} |
| 26 | 25 |
| 27 // Dispatches the event. If true is returned processing continues as | 26 // Dispatches the event. If true is returned processing continues as |
| 28 // normal. If false is returned, the nested loop exits immediately. | 27 // normal. If false is returned, the nested loop exits immediately. |
| 29 virtual bool Dispatch(const NativeEvent& event) = 0; | 28 virtual bool Dispatch(const NativeEvent& event) = 0; |
| 30 }; | 29 }; |
| 31 | 30 |
| 32 } // namespace base | 31 } // namespace base |
| 33 | 32 |
| 34 #endif // BASE_MESSAGE_PUMP_DISPATCHER_H | 33 #endif // BASE_MESSAGE_PUMP_DISPATCHER_H |
| OLD | NEW |