michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_activities_Activity_h michael@0: #define mozilla_dom_activities_Activity_h michael@0: michael@0: #include "DOMRequest.h" michael@0: #include "mozilla/dom/BindingDeclarations.h" michael@0: #include "mozilla/dom/MozActivityBinding.h" michael@0: #include "nsIActivityProxy.h" michael@0: #include "mozilla/Preferences.h" michael@0: #include "nsPIDOMWindow.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class Activity : public DOMRequest michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Activity, DOMRequest) michael@0: michael@0: virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: static already_AddRefed michael@0: Constructor(const GlobalObject& aOwner, michael@0: JSContext* aCx, michael@0: const ActivityOptions& aOptions, michael@0: ErrorResult& aRv) michael@0: { michael@0: nsCOMPtr window = do_QueryInterface(aOwner.GetAsSupports()); michael@0: if (!window) { michael@0: aRv.Throw(NS_ERROR_UNEXPECTED); michael@0: return nullptr; michael@0: } michael@0: michael@0: nsRefPtr activity = new Activity(window); michael@0: aRv = activity->Initialize(window, aCx, aOptions); michael@0: return activity.forget(); michael@0: } michael@0: michael@0: Activity(nsPIDOMWindow* aWindow); michael@0: michael@0: protected: michael@0: nsresult Initialize(nsPIDOMWindow* aWindow, michael@0: JSContext* aCx, michael@0: const ActivityOptions& aOptions); michael@0: michael@0: nsCOMPtr mProxy; michael@0: michael@0: ~Activity(); michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_activities_Activity_h