message_pump_android.h revision 7d4cd473f85ac64c3747c96c277f9e506a0d2246
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_LOOP_MESSAGE_PUMP_ANDROID_H_
6#define BASE_MESSAGE_LOOP_MESSAGE_PUMP_ANDROID_H_
7
8#include <jni.h>
9
10#include "base/base_export.h"
11#include "base/compiler_specific.h"
12#include "base/message_loop/message_pump.h"
13
14namespace base {
15
16class RunLoop;
17class TimeTicks;
18
19// This class implements a MessagePump needed for TYPE_UI MessageLoops on
20// OS_ANDROID platform.
21class BASE_EXPORT MessagePumpForUI : public MessagePump {
22 public:
23  MessagePumpForUI();
24
25  virtual void Run(Delegate* delegate) OVERRIDE;
26  virtual void Quit() OVERRIDE;
27  virtual void ScheduleWork() OVERRIDE;
28  virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE;
29
30  virtual void Start(Delegate* delegate);
31
32  static bool RegisterBindings(JNIEnv* env);
33
34 protected:
35  virtual ~MessagePumpForUI();
36
37 private:
38  RunLoop* run_loop_;
39
40  DISALLOW_COPY_AND_ASSIGN(MessagePumpForUI);
41};
42
43}  // namespace base
44
45#endif  // BASE_MESSAGE_LOOP_MESSAGE_PUMP_ANDROID_H_
46