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