/* THIS FILE IS AUTOGENERATED FROM SystemUpdate.webidl BY Codegen.py - DO NOT EDIT */

#ifndef mozilla_dom_SystemUpdateBinding_h
#define mozilla_dom_SystemUpdateBinding_h

#include "js/RootingAPI.h"
#include "jspubtd.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CallbackInterface.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/ToJSValue.h"
#include "nsWeakReference.h"

namespace mozilla {
namespace dom {

class EventHandlerNonNull;
struct NativePropertyHooks;
class Promise;
class ProtoAndIfaceCache;
class SystemUpdateManager;
struct SystemUpdateManagerAtoms;
struct SystemUpdatePackageInfoAtoms;
class SystemUpdateProvider;
struct SystemUpdateProviderAtoms;
struct SystemUpdateProviderInfoAtoms;

} // namespace dom
} // namespace mozilla

namespace mozilla {
namespace dom {

struct SystemUpdatePackageInfo : public DictionaryBase
{
  MOZ_INIT_OUTSIDE_CTOR uint64_t mBuildDate;
  MOZ_INIT_OUTSIDE_CTOR nsString mDescription;
  MOZ_INIT_OUTSIDE_CTOR uint64_t mSize;
  MOZ_INIT_OUTSIDE_CTOR nsString mType;
  MOZ_INIT_OUTSIDE_CTOR nsString mVersion;

  SystemUpdatePackageInfo();

  explicit inline SystemUpdatePackageInfo(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline SystemUpdatePackageInfo(const SystemUpdatePackageInfo& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const SystemUpdatePackageInfo& aOther);

private:
  static bool
  InitIds(JSContext* cx, SystemUpdatePackageInfoAtoms* atomsCache);
};

namespace binding_detail {
struct FastSystemUpdatePackageInfo : public SystemUpdatePackageInfo
{
  inline FastSystemUpdatePackageInfo()
    : SystemUpdatePackageInfo(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct SystemUpdateProviderInfo : public DictionaryBase
{
  MOZ_INIT_OUTSIDE_CTOR nsString mName;
  MOZ_INIT_OUTSIDE_CTOR nsString mUuid;

  SystemUpdateProviderInfo();

  explicit inline SystemUpdateProviderInfo(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline SystemUpdateProviderInfo(const SystemUpdateProviderInfo& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const SystemUpdateProviderInfo& aOther);

private:
  static bool
  InitIds(JSContext* cx, SystemUpdateProviderInfoAtoms* atomsCache);
};

namespace binding_detail {
struct FastSystemUpdateProviderInfo : public SystemUpdateProviderInfo
{
  inline FastSystemUpdateProviderInfo()
    : SystemUpdateProviderInfo(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


namespace SystemUpdateManagerBinding {

  typedef mozilla::dom::SystemUpdateManager NativeType;

  already_AddRefed<SystemUpdateManager>
  ConstructNavigatorObject(JSContext* cx, JS::Handle<JSObject*> obj, ErrorResult& aRv);

  bool
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);

  JSObject*
  DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);

  const JSClass*
  GetJSClass();

  bool
  Wrap(JSContext* aCx, mozilla::dom::SystemUpdateManager* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);

  template <class T>
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
  {
    JS::Rooted<JSObject*> reflector(aCx);
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
  }

  // We declare this as an array so that retrieving a pointer to this
  // binding's property hooks only requires compile/link-time resolvable
  // address arithmetic.  Declaring it as a pointer instead would require
  // doing a run-time load to fetch a pointer to this binding's property
  // hooks.  And then structures which embedded a pointer to this structure
  // would require a run-time load for proper initialization, which would
  // then induce static constructors.  Lots of static constructors.
  extern const NativePropertyHooks sNativePropertyHooks[];

  void
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);

  JS::Handle<JSObject*>
  GetProtoObjectHandle(JSContext* aCx);

  JS::Handle<JSObject*>
  GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);

  JSObject*
  GetConstructorObject(JSContext* aCx);

} // namespace SystemUpdateManagerBinding



namespace SystemUpdateProviderBinding {

  typedef mozilla::dom::SystemUpdateProvider NativeType;

  bool
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);

  JSObject*
  DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);

  const JSClass*
  GetJSClass();

  bool
  Wrap(JSContext* aCx, mozilla::dom::SystemUpdateProvider* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);

  template <class T>
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
  {
    JS::Rooted<JSObject*> reflector(aCx);
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
  }

  // We declare this as an array so that retrieving a pointer to this
  // binding's property hooks only requires compile/link-time resolvable
  // address arithmetic.  Declaring it as a pointer instead would require
  // doing a run-time load to fetch a pointer to this binding's property
  // hooks.  And then structures which embedded a pointer to this structure
  // would require a run-time load for proper initialization, which would
  // then induce static constructors.  Lots of static constructors.
  extern const NativePropertyHooks sNativePropertyHooks[];

  void
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);

  JS::Handle<JSObject*>
  GetProtoObjectHandle(JSContext* aCx);

  JS::Handle<JSObject*>
  GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);

  JSObject*
  GetConstructorObject(JSContext* aCx);

} // namespace SystemUpdateProviderBinding



class SystemUpdateManagerJSImpl : public CallbackInterface
{
public:
  explicit inline SystemUpdateManagerJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
    : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
  {
  }

  explicit inline SystemUpdateManagerJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal, const FastCallbackConstructor& )
    : CallbackInterface(aCx, aCallback, aIncumbentGlobal, FastCallbackConstructor())
  {
  }

  explicit inline SystemUpdateManagerJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
    : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
  {
  }

  already_AddRefed<Promise> GetProviders(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  already_AddRefed<Promise> SetActiveProvider(const nsAString& uuid, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  already_AddRefed<Promise> GetActiveProvider(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  inline bool
  operator==(const SystemUpdateManagerJSImpl& aOther) const
  {
    return CallbackInterface::operator==(aOther);
  }

private:
  static bool
  InitIds(JSContext* cx, SystemUpdateManagerAtoms* atomsCache);
};


class SystemUpdateManager final : public nsSupportsWeakReference,
                                  public nsWrapperCache
{
public:
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(SystemUpdateManager)

private:
  RefPtr<SystemUpdateManagerJSImpl> mImpl;
  nsCOMPtr<nsISupports> mParent;

public:
  SystemUpdateManager(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);

private:
  ~SystemUpdateManager();

public:
  nsISupports* GetParentObject() const;

  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;

  // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
  already_AddRefed<Promise> GetProviders(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
  already_AddRefed<Promise> SetActiveProvider(const nsAString& uuid, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  // Return a raw pointer here to avoid refcounting, but make sure it's safe (the object should be kept alive by the callee).
  already_AddRefed<Promise> GetActiveProvider(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  static bool
  _Create(JSContext* cx, unsigned argc, JS::Value* vp);
};


class SystemUpdateProviderJSImpl : public CallbackInterface
{
public:
  explicit inline SystemUpdateProviderJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
    : CallbackInterface(aCx, aCallback, aIncumbentGlobal)
  {
  }

  explicit inline SystemUpdateProviderJSImpl(JSContext* aCx, JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal, const FastCallbackConstructor& )
    : CallbackInterface(aCx, aCallback, aIncumbentGlobal, FastCallbackConstructor())
  {
  }

  explicit inline SystemUpdateProviderJSImpl(JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
    : CallbackInterface(aCallback, aAsyncStack, aIncumbentGlobal)
  {
  }

  void CheckForUpdate(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void StartDownload(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void StopDownload(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void ApplyUpdate(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  bool SetParameter(const nsAString& name, const nsAString& value, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void GetParameter(const nsAString& name, nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  inline bool
  operator==(const SystemUpdateProviderJSImpl& aOther) const
  {
    return CallbackInterface::operator==(aOther);
  }

  void GetName(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void GetUuid(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  already_AddRefed<EventHandlerNonNull> GetOnupdateavailable(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  already_AddRefed<EventHandlerNonNull> GetOnprogress(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  already_AddRefed<EventHandlerNonNull> GetOnupdateready(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  already_AddRefed<EventHandlerNonNull> GetOnerror(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void SetOnupdateavailable(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void SetOnprogress(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void SetOnupdateready(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void SetOnerror(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

private:
  static bool
  InitIds(JSContext* cx, SystemUpdateProviderAtoms* atomsCache);
};


class SystemUpdateProvider final : public mozilla::DOMEventTargetHelper
{
public:
  NS_DECL_ISUPPORTS_INHERITED
  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SystemUpdateProvider, mozilla::DOMEventTargetHelper)

private:
  RefPtr<SystemUpdateProviderJSImpl> mImpl;
  nsCOMPtr<nsISupports> mParent;

public:
  SystemUpdateProvider(JS::Handle<JSObject*> aJSImplObject, nsIGlobalObject* aParent);

private:
  ~SystemUpdateProvider();

public:
  nsISupports* GetParentObject() const;

  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;

  void GetName(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;

  void GetUuid(nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;

  already_AddRefed<EventHandlerNonNull> GetOnupdateavailable(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;

  void SetOnupdateavailable(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  already_AddRefed<EventHandlerNonNull> GetOnprogress(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;

  void SetOnprogress(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  already_AddRefed<EventHandlerNonNull> GetOnupdateready(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;

  void SetOnupdateready(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  already_AddRefed<EventHandlerNonNull> GetOnerror(ErrorResult& aRv, JSCompartment* aCompartment = nullptr) const;

  void SetOnerror(EventHandlerNonNull* arg, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void CheckForUpdate(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void StartDownload(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void StopDownload(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void ApplyUpdate(ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  bool SetParameter(const nsAString& name, const nsAString& value, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  void GetParameter(const nsAString& name, nsString& aRetVal, ErrorResult& aRv, JSCompartment* aCompartment = nullptr);

  static bool
  _Create(JSContext* cx, unsigned argc, JS::Value* vp);
};


} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_SystemUpdateBinding_h
