Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_time_TimeManager_h
8 : #define mozilla_dom_time_TimeManager_h
9 :
10 : #include "mozilla/Attributes.h"
11 : #include "nsISupports.h"
12 : #include "nsPIDOMWindow.h"
13 : #include "nsWrapperCache.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 : class Date;
19 :
20 : namespace time {
21 :
22 : class TimeManager final : public nsISupports
23 : , public nsWrapperCache
24 : {
25 : public:
26 0 : static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal)
27 : {
28 : #ifdef MOZ_TIME_MANAGER
29 : return true;
30 : #else
31 0 : return false;
32 : #endif
33 : }
34 :
35 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
36 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TimeManager)
37 :
38 : explicit TimeManager(nsPIDOMWindowInner* aWindow)
39 : : mWindow(aWindow)
40 : {
41 : }
42 :
43 0 : nsPIDOMWindowInner* GetParentObject() const
44 : {
45 0 : return mWindow;
46 : }
47 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
48 :
49 : void Set(Date& aDate);
50 : void Set(double aTime);
51 :
52 : private:
53 0 : ~TimeManager() {}
54 :
55 : nsCOMPtr<nsPIDOMWindowInner> mWindow;
56 : };
57 :
58 : } // namespace time
59 : } // namespace dom
60 : } // namespace mozilla
61 :
62 : #endif //mozilla_dom_time_TimeManager_h
|