dom/alarm/AlarmHalService.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/alarm/AlarmHalService.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 + 
     1.8 +#ifndef mozilla_dom_alarm_AlarmHalService_h
     1.9 +#define mozilla_dom_alarm_AlarmHalService_h
    1.10 +
    1.11 +#include "base/basictypes.h"
    1.12 +#include "mozilla/ClearOnShutdown.h"
    1.13 +#include "mozilla/StaticPtr.h"
    1.14 +#include "mozilla/Hal.h"
    1.15 +#include "mozilla/Services.h"
    1.16 +#include "nsIAlarmHalService.h"
    1.17 +#include "nsIObserver.h"
    1.18 +#include "nsIObserverService.h"
    1.19 +
    1.20 +namespace mozilla {
    1.21 +namespace dom {
    1.22 +namespace alarm {
    1.23 +  
    1.24 +typedef Observer<void_t> AlarmObserver;
    1.25 +typedef Observer<hal::SystemTimezoneChangeInformation> SystemTimezoneChangeObserver;
    1.26 +
    1.27 +class AlarmHalService : public nsIAlarmHalService, 
    1.28 +                        public AlarmObserver,
    1.29 +                        public SystemTimezoneChangeObserver
    1.30 +{
    1.31 +public:
    1.32 +  NS_DECL_ISUPPORTS
    1.33 +  NS_DECL_NSIALARMHALSERVICE
    1.34 +
    1.35 +  void Init();
    1.36 +  virtual ~AlarmHalService();
    1.37 +
    1.38 +  static already_AddRefed<AlarmHalService> GetInstance();
    1.39 +
    1.40 +  // Implementing hal::AlarmObserver
    1.41 +  void Notify(const void_t& aVoid);
    1.42 +
    1.43 +  // Implementing hal::SystemTimezoneChangeObserver
    1.44 +  void Notify(const hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo);
    1.45 +
    1.46 +private:
    1.47 +  bool mAlarmEnabled;
    1.48 +  static StaticRefPtr<AlarmHalService> sSingleton;
    1.49 +
    1.50 +  nsCOMPtr<nsIAlarmFiredCb> mAlarmFiredCb;
    1.51 +  nsCOMPtr<nsITimezoneChangedCb> mTimezoneChangedCb;
    1.52 +};
    1.53 +
    1.54 +} // namespace alarm
    1.55 +} // namespace dom
    1.56 +} // namespace mozilla
    1.57 +
    1.58 +#endif // mozilla_dom_alarm_AlarmHalService_h

mercurial