Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef mozilla_dom_alarm_AlarmHalService_h |
michael@0 | 6 | #define mozilla_dom_alarm_AlarmHalService_h |
michael@0 | 7 | |
michael@0 | 8 | #include "base/basictypes.h" |
michael@0 | 9 | #include "mozilla/ClearOnShutdown.h" |
michael@0 | 10 | #include "mozilla/StaticPtr.h" |
michael@0 | 11 | #include "mozilla/Hal.h" |
michael@0 | 12 | #include "mozilla/Services.h" |
michael@0 | 13 | #include "nsIAlarmHalService.h" |
michael@0 | 14 | #include "nsIObserver.h" |
michael@0 | 15 | #include "nsIObserverService.h" |
michael@0 | 16 | |
michael@0 | 17 | namespace mozilla { |
michael@0 | 18 | namespace dom { |
michael@0 | 19 | namespace alarm { |
michael@0 | 20 | |
michael@0 | 21 | typedef Observer<void_t> AlarmObserver; |
michael@0 | 22 | typedef Observer<hal::SystemTimezoneChangeInformation> SystemTimezoneChangeObserver; |
michael@0 | 23 | |
michael@0 | 24 | class AlarmHalService : public nsIAlarmHalService, |
michael@0 | 25 | public AlarmObserver, |
michael@0 | 26 | public SystemTimezoneChangeObserver |
michael@0 | 27 | { |
michael@0 | 28 | public: |
michael@0 | 29 | NS_DECL_ISUPPORTS |
michael@0 | 30 | NS_DECL_NSIALARMHALSERVICE |
michael@0 | 31 | |
michael@0 | 32 | void Init(); |
michael@0 | 33 | virtual ~AlarmHalService(); |
michael@0 | 34 | |
michael@0 | 35 | static already_AddRefed<AlarmHalService> GetInstance(); |
michael@0 | 36 | |
michael@0 | 37 | // Implementing hal::AlarmObserver |
michael@0 | 38 | void Notify(const void_t& aVoid); |
michael@0 | 39 | |
michael@0 | 40 | // Implementing hal::SystemTimezoneChangeObserver |
michael@0 | 41 | void Notify(const hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo); |
michael@0 | 42 | |
michael@0 | 43 | private: |
michael@0 | 44 | bool mAlarmEnabled; |
michael@0 | 45 | static StaticRefPtr<AlarmHalService> sSingleton; |
michael@0 | 46 | |
michael@0 | 47 | nsCOMPtr<nsIAlarmFiredCb> mAlarmFiredCb; |
michael@0 | 48 | nsCOMPtr<nsITimezoneChangedCb> mTimezoneChangedCb; |
michael@0 | 49 | }; |
michael@0 | 50 | |
michael@0 | 51 | } // namespace alarm |
michael@0 | 52 | } // namespace dom |
michael@0 | 53 | } // namespace mozilla |
michael@0 | 54 | |
michael@0 | 55 | #endif // mozilla_dom_alarm_AlarmHalService_h |