2012-07-20 15:41:30 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_activities_Activity_h
|
|
|
|
#define mozilla_dom_activities_Activity_h
|
|
|
|
|
|
|
|
#include "DOMRequest.h"
|
2013-03-17 08:51:36 +00:00
|
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
2014-03-18 04:38:36 +00:00
|
|
|
#include "mozilla/dom/MozActivityBinding.h"
|
2013-03-17 08:51:36 +00:00
|
|
|
#include "nsIActivityProxy.h"
|
2013-04-30 13:01:46 +00:00
|
|
|
#include "mozilla/Preferences.h"
|
2014-01-07 02:53:23 +00:00
|
|
|
#include "nsPIDOMWindow.h"
|
2012-07-20 15:41:30 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-03-17 08:51:36 +00:00
|
|
|
class Activity : public DOMRequest
|
2012-07-20 15:41:30 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Activity, DOMRequest)
|
|
|
|
|
2014-04-08 22:27:18 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2013-03-17 08:51:36 +00:00
|
|
|
|
|
|
|
static already_AddRefed<Activity>
|
|
|
|
Constructor(const GlobalObject& aOwner,
|
2014-03-18 04:38:36 +00:00
|
|
|
const ActivityOptions& aOptions,
|
2013-03-17 08:51:36 +00:00
|
|
|
ErrorResult& aRv)
|
|
|
|
{
|
2014-01-07 02:53:23 +00:00
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aOwner.GetAsSupports());
|
|
|
|
if (!window) {
|
|
|
|
aRv.Throw(NS_ERROR_UNEXPECTED);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsRefPtr<Activity> activity = new Activity(window);
|
2014-06-16 16:52:00 +00:00
|
|
|
aRv = activity->Initialize(window, aOwner.Context(), aOptions);
|
2013-03-17 08:51:36 +00:00
|
|
|
return activity.forget();
|
|
|
|
}
|
2012-07-20 15:41:30 +00:00
|
|
|
|
2014-09-01 22:26:43 +00:00
|
|
|
explicit Activity(nsPIDOMWindow* aWindow);
|
2012-07-21 13:59:48 +00:00
|
|
|
|
2012-07-20 15:41:30 +00:00
|
|
|
protected:
|
2014-01-07 02:53:23 +00:00
|
|
|
nsresult Initialize(nsPIDOMWindow* aWindow,
|
2014-03-18 04:38:36 +00:00
|
|
|
JSContext* aCx,
|
|
|
|
const ActivityOptions& aOptions);
|
2013-03-17 08:51:36 +00:00
|
|
|
|
2012-07-20 15:41:30 +00:00
|
|
|
nsCOMPtr<nsIActivityProxy> mProxy;
|
|
|
|
|
|
|
|
~Activity();
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_activities_Activity_h
|