dom/alarm/AlarmHalService.h

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:ceb63e001513
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #ifndef mozilla_dom_alarm_AlarmHalService_h
6 #define mozilla_dom_alarm_AlarmHalService_h
7
8 #include "base/basictypes.h"
9 #include "mozilla/ClearOnShutdown.h"
10 #include "mozilla/StaticPtr.h"
11 #include "mozilla/Hal.h"
12 #include "mozilla/Services.h"
13 #include "nsIAlarmHalService.h"
14 #include "nsIObserver.h"
15 #include "nsIObserverService.h"
16
17 namespace mozilla {
18 namespace dom {
19 namespace alarm {
20
21 typedef Observer<void_t> AlarmObserver;
22 typedef Observer<hal::SystemTimezoneChangeInformation> SystemTimezoneChangeObserver;
23
24 class AlarmHalService : public nsIAlarmHalService,
25 public AlarmObserver,
26 public SystemTimezoneChangeObserver
27 {
28 public:
29 NS_DECL_ISUPPORTS
30 NS_DECL_NSIALARMHALSERVICE
31
32 void Init();
33 virtual ~AlarmHalService();
34
35 static already_AddRefed<AlarmHalService> GetInstance();
36
37 // Implementing hal::AlarmObserver
38 void Notify(const void_t& aVoid);
39
40 // Implementing hal::SystemTimezoneChangeObserver
41 void Notify(const hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo);
42
43 private:
44 bool mAlarmEnabled;
45 static StaticRefPtr<AlarmHalService> sSingleton;
46
47 nsCOMPtr<nsIAlarmFiredCb> mAlarmFiredCb;
48 nsCOMPtr<nsITimezoneChangedCb> mTimezoneChangedCb;
49 };
50
51 } // namespace alarm
52 } // namespace dom
53 } // namespace mozilla
54
55 #endif // mozilla_dom_alarm_AlarmHalService_h

mercurial