2015-10-01 20:40:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "Hal.h"
|
2016-07-21 09:07:12 +03:00
|
|
|
#include "AndroidBridge.h"
|
2015-10-01 20:40:53 +03:00
|
|
|
|
|
|
|
#include "GeneratedJNINatives.h"
|
|
|
|
|
|
|
|
using namespace mozilla::hal;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2016-07-21 09:07:12 +03:00
|
|
|
class AlarmReceiver : public widget::AlarmReceiver::Natives<AlarmReceiver>
|
2015-10-01 20:40:53 +03:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
AlarmReceiver();
|
|
|
|
|
|
|
|
public:
|
|
|
|
static void NotifyAlarmFired() {
|
|
|
|
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([=]() {
|
|
|
|
hal::NotifyAlarmFired();
|
|
|
|
});
|
|
|
|
NS_DispatchToMainThread(runnable);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace hal_impl {
|
|
|
|
|
|
|
|
bool
|
|
|
|
EnableAlarm()
|
|
|
|
{
|
|
|
|
AlarmReceiver::Init();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DisableAlarm()
|
|
|
|
{
|
2016-07-21 09:07:12 +03:00
|
|
|
widget::GeckoAppShell::DisableAlarm();
|
2015-10-01 20:40:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SetAlarm(int32_t aSeconds, int32_t aNanoseconds)
|
|
|
|
{
|
2016-07-21 09:07:12 +03:00
|
|
|
return widget::GeckoAppShell::SetAlarm(aSeconds, aNanoseconds);
|
2015-10-01 20:40:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
} // hal_impl
|
|
|
|
} // mozilla
|