[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(); | ||||
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 25 | |
26 | virtual void Run(Delegate* delegate) OVERRIDE; | ||||
27 | virtual void Quit() OVERRIDE; | ||||
28 | virtual void ScheduleWork() OVERRIDE; | ||||
29 | virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE; | ||||
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 30 | |
31 | virtual void Start(Delegate* delegate); | ||||
32 | |||||
[email protected] | 4235468 | 2012-07-09 22:12:16 | [diff] [blame] | 33 | static bool RegisterBindings(JNIEnv* env); |
34 | |||||
35 | protected: | ||||
36 | virtual ~MessagePumpForUI(); | ||||
37 | |||||
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 38 | private: |
[email protected] | 59e69e74 | 2013-06-18 20:27:52 | [diff] [blame] | 39 | RunLoop* run_loop_; |
[email protected] | 3042d1b | 2013-07-02 18:54:05 | [diff] [blame^] | 40 | base::android::ScopedJavaGlobalRef<jobject> system_message_handler_obj_; |
[email protected] | 61c86c6 | 2011-08-02 16:11:16 | [diff] [blame] | 41 | |
42 | DISALLOW_COPY_AND_ASSIGN(MessagePumpForUI); | ||||
43 | }; | ||||
44 | |||||
45 | } // namespace base | ||||
46 | |||||
[email protected] | 59e69e74 | 2013-06-18 20:27:52 | [diff] [blame] | 47 | #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_ANDROID_H_ |