2017-10-27 01:08:41 +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: */
|
2017-05-23 03:09:49 +03: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_CredentialsContainer_h
|
|
|
|
#define mozilla_dom_CredentialsContainer_h
|
|
|
|
|
|
|
|
#include "mozilla/dom/CredentialManagementBinding.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2017-12-05 21:05:06 +03:00
|
|
|
class WebAuthnManager;
|
|
|
|
|
2017-05-23 03:09:49 +03:00
|
|
|
class CredentialsContainer final : public nsISupports, public nsWrapperCache {
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CredentialsContainer)
|
|
|
|
|
|
|
|
explicit CredentialsContainer(nsPIDOMWindowInner* aParent);
|
|
|
|
|
|
|
|
nsPIDOMWindowInner* GetParentObject() const { return mParent; }
|
|
|
|
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
2017-10-13 04:18:39 +03:00
|
|
|
already_AddRefed<Promise> Get(const CredentialRequestOptions& aOptions,
|
|
|
|
ErrorResult& aRv);
|
2017-12-05 21:05:06 +03:00
|
|
|
|
2017-10-13 04:18:39 +03:00
|
|
|
already_AddRefed<Promise> Create(const CredentialCreationOptions& aOptions,
|
|
|
|
ErrorResult& aRv);
|
2017-12-05 21:05:06 +03:00
|
|
|
|
2017-10-13 04:18:39 +03:00
|
|
|
already_AddRefed<Promise> Store(const Credential& aCredential,
|
|
|
|
ErrorResult& aRv);
|
2017-05-23 03:09:49 +03:00
|
|
|
|
2018-02-22 16:36:08 +03:00
|
|
|
already_AddRefed<Promise> PreventSilentAccess(ErrorResult& aRv);
|
|
|
|
|
2017-05-23 03:09:49 +03:00
|
|
|
private:
|
|
|
|
~CredentialsContainer();
|
|
|
|
|
2017-12-05 21:05:06 +03:00
|
|
|
void EnsureWebAuthnManager();
|
|
|
|
|
2017-05-23 03:09:49 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> mParent;
|
2017-12-05 21:05:06 +03:00
|
|
|
RefPtr<WebAuthnManager> mManager;
|
2017-05-23 03:09:49 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_CredentialsContainer_h
|