2012-07-20 08:41:30 -07: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 01:51:36 -07:00
|
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
2014-03-17 21:38:36 -07:00
|
|
|
#include "mozilla/dom/MozActivityBinding.h"
|
2013-03-17 01:51:36 -07:00
|
|
|
#include "nsIActivityProxy.h"
|
2013-04-30 06:01:46 -07:00
|
|
|
#include "mozilla/Preferences.h"
|
2014-01-06 18:53:23 -08:00
|
|
|
#include "nsPIDOMWindow.h"
|
2012-07-20 08:41:30 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-03-17 01:51:36 -07:00
|
|
|
class Activity : public DOMRequest
|
2012-07-20 08:41:30 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Activity, DOMRequest)
|
|
|
|
|
2014-04-08 15:27:18 -07:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2013-03-17 01:51:36 -07:00
|
|
|
|
|
|
|
static already_AddRefed<Activity>
|
|
|
|
Constructor(const GlobalObject& aOwner,
|
2014-03-17 21:38:36 -07:00
|
|
|
const ActivityOptions& aOptions,
|
2013-03-17 01:51:36 -07:00
|
|
|
ErrorResult& aRv)
|
|
|
|
{
|
2014-01-06 18:53:23 -08: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 09:52:00 -07:00
|
|
|
aRv = activity->Initialize(window, aOwner.Context(), aOptions);
|
2013-03-17 01:51:36 -07:00
|
|
|
return activity.forget();
|
|
|
|
}
|
2012-07-20 08:41:30 -07:00
|
|
|
|
2014-09-01 15:26:43 -07:00
|
|
|
explicit Activity(nsPIDOMWindow* aWindow);
|
2012-07-21 06:59:48 -07:00
|
|
|
|
2012-07-20 08:41:30 -07:00
|
|
|
protected:
|
2014-01-06 18:53:23 -08:00
|
|
|
nsresult Initialize(nsPIDOMWindow* aWindow,
|
2014-03-17 21:38:36 -07:00
|
|
|
JSContext* aCx,
|
|
|
|
const ActivityOptions& aOptions);
|
2013-03-17 01:51:36 -07:00
|
|
|
|
2012-07-20 08:41:30 -07:00
|
|
|
nsCOMPtr<nsIActivityProxy> mProxy;
|
|
|
|
|
|
|
|
~Activity();
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_activities_Activity_h
|