2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-07-06 14:42:36 +04: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/. */
|
2015-04-09 20:22:37 +03:00
|
|
|
|
2012-07-06 14:42:36 +04:00
|
|
|
#ifndef mozilla_dom_alarm_AlarmHalService_h
|
|
|
|
#define mozilla_dom_alarm_AlarmHalService_h
|
|
|
|
|
|
|
|
#include "base/basictypes.h"
|
|
|
|
#include "mozilla/ClearOnShutdown.h"
|
2012-07-26 23:33:45 +04:00
|
|
|
#include "mozilla/StaticPtr.h"
|
2012-07-06 14:42:36 +04:00
|
|
|
#include "mozilla/Hal.h"
|
|
|
|
#include "mozilla/Services.h"
|
|
|
|
#include "nsIAlarmHalService.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsIObserverService.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
namespace alarm {
|
2015-04-09 20:22:37 +03:00
|
|
|
|
2012-10-23 11:15:43 +04:00
|
|
|
typedef Observer<void_t> AlarmObserver;
|
|
|
|
typedef Observer<hal::SystemTimezoneChangeInformation> SystemTimezoneChangeObserver;
|
2015-04-09 20:22:37 +03:00
|
|
|
typedef Observer<int64_t> SystemClockChangeObserver;
|
2012-09-12 14:15:15 +04:00
|
|
|
|
2015-04-09 20:22:37 +03:00
|
|
|
class AlarmHalService : public nsIAlarmHalService,
|
2012-09-12 14:15:15 +04:00
|
|
|
public AlarmObserver,
|
2015-04-09 20:22:37 +03:00
|
|
|
public SystemTimezoneChangeObserver,
|
|
|
|
public SystemClockChangeObserver
|
2012-07-06 14:42:36 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIALARMHALSERVICE
|
|
|
|
|
|
|
|
void Init();
|
|
|
|
|
2012-10-23 11:15:43 +04:00
|
|
|
static already_AddRefed<AlarmHalService> GetInstance();
|
2012-07-06 14:42:36 +04:00
|
|
|
|
|
|
|
// Implementing hal::AlarmObserver
|
2015-03-21 19:28:04 +03:00
|
|
|
void Notify(const void_t& aVoid) override;
|
2012-07-06 14:42:36 +04:00
|
|
|
|
2012-10-23 11:15:43 +04:00
|
|
|
// Implementing hal::SystemTimezoneChangeObserver
|
2015-03-21 19:28:04 +03:00
|
|
|
void Notify(const hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo) override;
|
2012-09-12 14:15:15 +04:00
|
|
|
|
2015-04-09 20:22:37 +03:00
|
|
|
// Implementing hal::SystemClockChangeObserver
|
2015-04-10 19:27:37 +03:00
|
|
|
void Notify(const int64_t& aClockDeltaMS) override;
|
2015-04-09 20:22:37 +03:00
|
|
|
|
2012-07-06 14:42:36 +04:00
|
|
|
private:
|
2014-06-23 23:56:07 +04:00
|
|
|
virtual ~AlarmHalService();
|
|
|
|
|
2012-07-06 14:42:36 +04:00
|
|
|
bool mAlarmEnabled;
|
2012-07-26 23:33:45 +04:00
|
|
|
static StaticRefPtr<AlarmHalService> sSingleton;
|
2012-07-06 14:42:36 +04:00
|
|
|
|
2012-09-12 14:15:15 +04:00
|
|
|
nsCOMPtr<nsIAlarmFiredCb> mAlarmFiredCb;
|
2012-07-06 14:42:36 +04:00
|
|
|
nsCOMPtr<nsITimezoneChangedCb> mTimezoneChangedCb;
|
2015-04-09 20:22:37 +03:00
|
|
|
nsCOMPtr<nsISystemClockChangedCb> mSystemClockChangedCb;
|
2012-07-06 14:42:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace alarm
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_alarm_AlarmHalService_h
|