2012-07-06 03:42:36 -07:00
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_alarm_AlarmHalService_h
|
|
|
|
#define mozilla_dom_alarm_AlarmHalService_h
|
|
|
|
|
|
|
|
#include "base/basictypes.h"
|
|
|
|
#include "mozilla/ClearOnShutdown.h"
|
2012-07-26 12:33:45 -07:00
|
|
|
#include "mozilla/StaticPtr.h"
|
2012-07-06 03:42:36 -07:00
|
|
|
#include "mozilla/Hal.h"
|
|
|
|
#include "mozilla/Services.h"
|
|
|
|
#include "nsIAlarmHalService.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsIObserverService.h"
|
|
|
|
#include "prtime.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
namespace alarm {
|
|
|
|
|
2012-09-12 03:15:15 -07:00
|
|
|
using namespace hal;
|
|
|
|
|
2012-07-06 03:42:36 -07:00
|
|
|
class AlarmHalService : public nsIAlarmHalService,
|
2012-09-12 03:15:15 -07:00
|
|
|
public AlarmObserver,
|
|
|
|
public SystemTimeObserver
|
2012-07-06 03:42:36 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIALARMHALSERVICE
|
|
|
|
|
|
|
|
void Init();
|
|
|
|
virtual ~AlarmHalService();
|
|
|
|
|
|
|
|
static already_AddRefed<nsIAlarmHalService> GetInstance();
|
|
|
|
|
|
|
|
// Implementing hal::AlarmObserver
|
|
|
|
void Notify(const mozilla::void_t& aVoid);
|
|
|
|
|
2012-09-12 03:15:15 -07:00
|
|
|
// Implementing hal::SystemTimeObserver
|
|
|
|
void Notify(const SystemTimeChange& aReason);
|
|
|
|
|
2012-07-06 03:42:36 -07:00
|
|
|
private:
|
|
|
|
bool mAlarmEnabled;
|
2012-07-26 12:33:45 -07:00
|
|
|
static StaticRefPtr<AlarmHalService> sSingleton;
|
2012-07-06 03:42:36 -07:00
|
|
|
|
2012-09-12 03:15:15 -07:00
|
|
|
nsCOMPtr<nsIAlarmFiredCb> mAlarmFiredCb;
|
2012-07-06 03:42:36 -07:00
|
|
|
nsCOMPtr<nsITimezoneChangedCb> mTimezoneChangedCb;
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetTimezoneOffset(bool aIgnoreDST);
|
2012-07-06 03:42:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace alarm
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_alarm_AlarmHalService_h
|