blob: 5ef4bd6920380a9f8daeea197807a27f19dc1c08 [file] [log] [blame]
jbates@chromium.org5d5b2812012-06-29 07:57:30 +09001// Copyright (c) 2012 The Chromium Authors. All rights reserved.
michaelbai@google.com686190b2011-08-03 01:11:16 +09002// 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_ANDROID_H_
6#define BASE_MESSAGE_PUMP_ANDROID_H_
michaelbai@google.com686190b2011-08-03 01:11:16 +09007
nileshagrawal@chromium.org23582c92012-07-10 07:12:16 +09008#include <jni.h>
9
yfriedman@chromium.orgc02fde52012-11-02 02:38:47 +090010#include "base/base_export.h"
michaelbai@google.com686190b2011-08-03 01:11:16 +090011#include "base/compiler_specific.h"
michaelbai@google.com686190b2011-08-03 01:11:16 +090012#include "base/message_pump.h"
michaelbai@google.com686190b2011-08-03 01:11:16 +090013
14namespace base {
thestig@chromium.orge476b202012-10-10 10:25:05 +090015
jbates@chromium.org5d5b2812012-06-29 07:57:30 +090016class RunLoop;
thestig@chromium.orge476b202012-10-10 10:25:05 +090017class TimeTicks;
michaelbai@google.com686190b2011-08-03 01:11:16 +090018
19// This class implements a MessagePump needed for TYPE_UI MessageLoops on
20// OS_ANDROID platform.
yfriedman@chromium.orgc02fde52012-11-02 02:38:47 +090021class BASE_EXPORT MessagePumpForUI : public MessagePump {
michaelbai@google.com686190b2011-08-03 01:11:16 +090022 public:
23 MessagePumpForUI();
michaelbai@google.com686190b2011-08-03 01:11:16 +090024
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
nileshagrawal@chromium.org23582c92012-07-10 07:12:16 +090032 static bool RegisterBindings(JNIEnv* env);
33
34 protected:
35 virtual ~MessagePumpForUI();
36
michaelbai@google.com686190b2011-08-03 01:11:16 +090037 private:
jbates@chromium.org5d5b2812012-06-29 07:57:30 +090038 base::RunLoop* run_loop_;
michaelbai@google.com686190b2011-08-03 01:11:16 +090039
40 DISALLOW_COPY_AND_ASSIGN(MessagePumpForUI);
41};
42
43} // namespace base
44
45#endif // BASE_MESSAGE_PUMP_ANDROID_H_