Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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/. */
5 #ifndef mozilla_dom_activities_Activity_h
6 #define mozilla_dom_activities_Activity_h
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"
15 namespace mozilla {
16 namespace dom {
18 class Activity : public DOMRequest
19 {
20 public:
21 NS_DECL_ISUPPORTS_INHERITED
22 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Activity, DOMRequest)
24 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
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 }
38 nsRefPtr<Activity> activity = new Activity(window);
39 aRv = activity->Initialize(window, aCx, aOptions);
40 return activity.forget();
41 }
43 Activity(nsPIDOMWindow* aWindow);
45 protected:
46 nsresult Initialize(nsPIDOMWindow* aWindow,
47 JSContext* aCx,
48 const ActivityOptions& aOptions);
50 nsCOMPtr<nsIActivityProxy> mProxy;
52 ~Activity();
53 };
55 } // namespace dom
56 } // namespace mozilla
58 #endif // mozilla_dom_activities_Activity_h