[email protected] | 8e937c1e | 2012-06-28 22:57:30 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 59e69e74 | 2013-06-18 20:27:52 | [diff] [blame] | 5 | #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_ANDROID_H_ |
6 | #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_ANDROID_H_ | ||||
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 7 | |
[email protected] | 4235468 | 2012-07-09 22:12:16 | [diff] [blame] | 8 | #include <jni.h> |
9 | |||||
[email protected] | 3042d1b | 2013-07-02 18:54:05 | [diff] [blame] | 10 | #include "base/android/scoped_java_ref.h" |
[email protected] | be363b2 | 2012-11-01 17:38:47 | [diff] [blame] | 11 | #include "base/base_export.h" |
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 12 | #include "base/compiler_specific.h" |
[email protected] | 59e69e74 | 2013-06-18 20:27:52 | [diff] [blame] | 13 | #include "base/message_loop/message_pump.h" |
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 14 | |
15 | namespace base { | ||||
[email protected] | efbee2031 | 2012-10-10 01:25:05 | [diff] [blame] | 16 | |
[email protected] | 8e937c1e | 2012-06-28 22:57:30 | [diff] [blame] | 17 | class RunLoop; |
[email protected] | efbee2031 | 2012-10-10 01:25:05 | [diff] [blame] | 18 | class TimeTicks; |
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 19 | |
20 | // This class implements a MessagePump needed for TYPE_UI MessageLoops on | ||||
21 | // OS_ANDROID platform. | ||||
[email protected] | be363b2 | 2012-11-01 17:38:47 | [diff] [blame] | 22 | class BASE_EXPORT MessagePumpForUI : public MessagePump { |
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 23 | public: |
24 | MessagePumpForUI(); | ||||
dcheng | 8e3e03e | 2015-02-06 03:32:20 | [diff] [blame^] | 25 | ~MessagePumpForUI() override; |
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 26 | |
dcheng | 8e3e03e | 2015-02-06 03:32:20 | [diff] [blame^] | 27 | void Run(Delegate* delegate) override; |
28 | void Quit() override; | ||||
29 | void ScheduleWork() override; | ||||
30 | void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; | ||||
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 31 | |
32 | virtual void Start(Delegate* delegate); | ||||
33 | |||||
[email protected] | 4235468 | 2012-07-09 22:12:16 | [diff] [blame] | 34 | static bool RegisterBindings(JNIEnv* env); |
35 | |||||
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 36 | private: |
[email protected] | 59e69e74 | 2013-06-18 20:27:52 | [diff] [blame] | 37 | RunLoop* run_loop_; |
[email protected] | 3042d1b | 2013-07-02 18:54:05 | [diff] [blame] | 38 | base::android::ScopedJavaGlobalRef<jobject> system_message_handler_obj_; |
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 39 | |
40 | DISALLOW_COPY_AND_ASSIGN(MessagePumpForUI); | ||||
41 | }; | ||||
42 | |||||
43 | } // namespace base | ||||
44 | |||||
[email protected] | 59e69e74 | 2013-06-18 20:27:52 | [diff] [blame] | 45 | #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_ANDROID_H_ |