2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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)
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) 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;
|
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<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
|