1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/activities/src/Activity.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef mozilla_dom_activities_Activity_h 1.9 +#define mozilla_dom_activities_Activity_h 1.10 + 1.11 +#include "DOMRequest.h" 1.12 +#include "mozilla/dom/BindingDeclarations.h" 1.13 +#include "mozilla/dom/MozActivityBinding.h" 1.14 +#include "nsIActivityProxy.h" 1.15 +#include "mozilla/Preferences.h" 1.16 +#include "nsPIDOMWindow.h" 1.17 + 1.18 +namespace mozilla { 1.19 +namespace dom { 1.20 + 1.21 +class Activity : public DOMRequest 1.22 +{ 1.23 +public: 1.24 + NS_DECL_ISUPPORTS_INHERITED 1.25 + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Activity, DOMRequest) 1.26 + 1.27 + virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; 1.28 + 1.29 + static already_AddRefed<Activity> 1.30 + Constructor(const GlobalObject& aOwner, 1.31 + JSContext* aCx, 1.32 + const ActivityOptions& aOptions, 1.33 + ErrorResult& aRv) 1.34 + { 1.35 + nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aOwner.GetAsSupports()); 1.36 + if (!window) { 1.37 + aRv.Throw(NS_ERROR_UNEXPECTED); 1.38 + return nullptr; 1.39 + } 1.40 + 1.41 + nsRefPtr<Activity> activity = new Activity(window); 1.42 + aRv = activity->Initialize(window, aCx, aOptions); 1.43 + return activity.forget(); 1.44 + } 1.45 + 1.46 + Activity(nsPIDOMWindow* aWindow); 1.47 + 1.48 +protected: 1.49 + nsresult Initialize(nsPIDOMWindow* aWindow, 1.50 + JSContext* aCx, 1.51 + const ActivityOptions& aOptions); 1.52 + 1.53 + nsCOMPtr<nsIActivityProxy> mProxy; 1.54 + 1.55 + ~Activity(); 1.56 +}; 1.57 + 1.58 +} // namespace dom 1.59 +} // namespace mozilla 1.60 + 1.61 +#endif // mozilla_dom_activities_Activity_h