|
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_activities_Activity_h |
|
6 #define mozilla_dom_activities_Activity_h |
|
7 |
|
8 #include "DOMRequest.h" |
|
9 #include "mozilla/dom/BindingDeclarations.h" |
|
10 #include "mozilla/dom/MozActivityBinding.h" |
|
11 #include "nsIActivityProxy.h" |
|
12 #include "mozilla/Preferences.h" |
|
13 #include "nsPIDOMWindow.h" |
|
14 |
|
15 namespace mozilla { |
|
16 namespace dom { |
|
17 |
|
18 class Activity : public DOMRequest |
|
19 { |
|
20 public: |
|
21 NS_DECL_ISUPPORTS_INHERITED |
|
22 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Activity, DOMRequest) |
|
23 |
|
24 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
|
25 |
|
26 static already_AddRefed<Activity> |
|
27 Constructor(const GlobalObject& aOwner, |
|
28 JSContext* aCx, |
|
29 const ActivityOptions& aOptions, |
|
30 ErrorResult& aRv) |
|
31 { |
|
32 nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aOwner.GetAsSupports()); |
|
33 if (!window) { |
|
34 aRv.Throw(NS_ERROR_UNEXPECTED); |
|
35 return nullptr; |
|
36 } |
|
37 |
|
38 nsRefPtr<Activity> activity = new Activity(window); |
|
39 aRv = activity->Initialize(window, aCx, aOptions); |
|
40 return activity.forget(); |
|
41 } |
|
42 |
|
43 Activity(nsPIDOMWindow* aWindow); |
|
44 |
|
45 protected: |
|
46 nsresult Initialize(nsPIDOMWindow* aWindow, |
|
47 JSContext* aCx, |
|
48 const ActivityOptions& aOptions); |
|
49 |
|
50 nsCOMPtr<nsIActivityProxy> mProxy; |
|
51 |
|
52 ~Activity(); |
|
53 }; |
|
54 |
|
55 } // namespace dom |
|
56 } // namespace mozilla |
|
57 |
|
58 #endif // mozilla_dom_activities_Activity_h |