2012-07-06 10:42:36 +00: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 19:33:45 +00:00
|
|
|
#include "mozilla/StaticPtr.h"
|
2012-07-06 10:42:36 +00:00
|
|
|
#include "mozilla/Hal.h"
|
|
|
|
#include "mozilla/Services.h"
|
|
|
|
#include "nsIAlarmHalService.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsIObserverService.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
namespace alarm {
|
2012-10-23 07:15:43 +00:00
|
|
|
|
|
|
|
typedef Observer<void_t> AlarmObserver;
|
|
|
|
typedef Observer<hal::SystemTimezoneChangeInformation> SystemTimezoneChangeObserver;
|
2012-09-12 10:15:15 +00:00
|
|
|
|
2012-07-06 10:42:36 +00:00
|
|
|
class AlarmHalService : public nsIAlarmHalService,
|
2012-09-12 10:15:15 +00:00
|
|
|
public AlarmObserver,
|
2012-10-23 07:15:43 +00:00
|
|
|
public SystemTimezoneChangeObserver
|
2012-07-06 10:42:36 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIALARMHALSERVICE
|
|
|
|
|
|
|
|
void Init();
|
|
|
|
virtual ~AlarmHalService();
|
|
|
|
|
2012-10-23 07:15:43 +00:00
|
|
|
static already_AddRefed<AlarmHalService> GetInstance();
|
2012-07-06 10:42:36 +00:00
|
|
|
|
|
|
|
// Implementing hal::AlarmObserver
|
2012-10-23 07:15:43 +00:00
|
|
|
void Notify(const void_t& aVoid);
|
2012-07-06 10:42:36 +00:00
|
|
|
|
2012-10-23 07:15:43 +00:00
|
|
|
// Implementing hal::SystemTimezoneChangeObserver
|
|
|
|
void Notify(const hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo);
|
2012-09-12 10:15:15 +00:00
|
|
|
|
2012-07-06 10:42:36 +00:00
|
|
|
private:
|
|
|
|
bool mAlarmEnabled;
|
2012-07-26 19:33:45 +00:00
|
|
|
static StaticRefPtr<AlarmHalService> sSingleton;
|
2012-07-06 10:42:36 +00:00
|
|
|
|
2012-09-12 10:15:15 +00:00
|
|
|
nsCOMPtr<nsIAlarmFiredCb> mAlarmFiredCb;
|
2012-07-06 10:42:36 +00:00
|
|
|
nsCOMPtr<nsITimezoneChangedCb> mTimezoneChangedCb;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace alarm
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_alarm_AlarmHalService_h
|