dom/time/TimeManager.h

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:46cf3989aaa5
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
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #ifndef mozilla_dom_time_TimeManager_h
6 #define mozilla_dom_time_TimeManager_h
7
8 #include "mozilla/Attributes.h"
9 #include "nsISupports.h"
10 #include "nsPIDOMWindow.h"
11 #include "nsWrapperCache.h"
12
13 namespace mozilla {
14 namespace dom {
15
16 class Date;
17
18 namespace time {
19
20 class TimeManager MOZ_FINAL : public nsISupports
21 , public nsWrapperCache
22 {
23 public:
24 static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal)
25 {
26 #ifdef MOZ_TIME_MANAGER
27 return true;
28 #else
29 return false;
30 #endif
31 }
32
33 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
34 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TimeManager)
35
36 explicit TimeManager(nsPIDOMWindow* aWindow)
37 : mWindow(aWindow)
38 {
39 SetIsDOMBinding();
40 }
41
42 nsPIDOMWindow* GetParentObject() const
43 {
44 return mWindow;
45 }
46 JSObject* WrapObject(JSContext* aCx);
47
48 void Set(Date& aDate);
49 void Set(double aTime);
50
51 private:
52 nsCOMPtr<nsPIDOMWindow> mWindow;
53 };
54
55 } // namespace time
56 } // namespace dom
57 } // namespace mozilla
58
59 #endif //mozilla_dom_time_TimeManager_h

mercurial