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"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
namespace alarm {
|
2012-10-23 00:15:43 -07:00
|
|
|
|
|
|
|
typedef Observer<void_t> AlarmObserver;
|
|
|
|
typedef Observer<hal::SystemTimezoneChangeInformation> SystemTimezoneChangeObserver;
|
2012-09-12 03:15:15 -07:00
|
|
|
|
2012-07-06 03:42:36 -07:00
|
|
|
class AlarmHalService : public nsIAlarmHalService,
|
2012-09-12 03:15:15 -07:00
|
|
|
public AlarmObserver,
|
2012-10-23 00:15:43 -07:00
|
|
|
public SystemTimezoneChangeObserver
|
2012-07-06 03:42:36 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIALARMHALSERVICE
|
|
|
|
|
|
|
|
void Init();
|
|
|
|
|
2012-10-23 00:15:43 -07:00
|
|
|
static already_AddRefed<AlarmHalService> GetInstance();
|
2012-07-06 03:42:36 -07:00
|
|
|
|
|
|
|
// Implementing hal::AlarmObserver
|
2015-01-07 09:00:44 -08:00
|
|
|
void Notify(const void_t& aVoid) MOZ_OVERRIDE;
|
2012-07-06 03:42:36 -07:00
|
|
|
|
2012-10-23 00:15:43 -07:00
|
|
|
// Implementing hal::SystemTimezoneChangeObserver
|
2015-01-07 09:00:44 -08:00
|
|
|
void Notify(const hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo) MOZ_OVERRIDE;
|
2012-09-12 03:15:15 -07:00
|
|
|
|
2012-07-06 03:42:36 -07:00
|
|
|
private:
|
2014-06-23 12:56:07 -07:00
|
|
|
virtual ~AlarmHalService();
|
|
|
|
|
2012-07-06 03:42:36 -07:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace alarm
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_alarm_AlarmHalService_h
|