Bug 1409135 - Cleanup and rearrange {WebAuthn,U2F}Manager.h r=jcj

Summary:
Both files declare a few methods as public that we can make private. Let's
seize the chance to rearrange declarations such that they reflect the message
model better.

Reviewers: jcj

Reviewed By: jcj

Bug #: 1409135

Differential Revision: https://phabricator.services.mozilla.com/D128

--HG--
extra : amend_source : 8f7a9d92ec81253847c44d92c71ea00cc8753bd1
This commit is contained in:
Tim Taubert 2017-10-17 11:31:30 +02:00
Родитель f7e1c16e21
Коммит 382ba57162
2 изменённых файлов: 27 добавлений и 26 удалений

Просмотреть файл

@ -59,15 +59,11 @@ class U2FManager final : public nsIIPCBackgroundChildCreateCallback
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
static U2FManager* GetOrCreate();
static U2FManager* Get();
void FinishRegister(nsTArray<uint8_t>& aRegBuffer);
void FinishSign(nsTArray<uint8_t>& aCredentialId,
nsTArray<uint8_t>& aSigBuffer);
void Cancel(const nsresult& aError);
void RequestAborted(const nsresult& aError);
already_AddRefed<U2FPromise> Register(nsPIDOMWindowInner* aParent,
const nsCString& aRpId,
const nsCString& aClientDataJSON,
@ -79,18 +75,23 @@ public:
const uint32_t& aTimeoutMillis,
const nsTArray<WebAuthnScopedCredentialDescriptor>& aKeyList);
void StartRegister();
void StartSign();
void StartCancel();
void FinishRegister(nsTArray<uint8_t>& aRegBuffer);
void FinishSign(nsTArray<uint8_t>& aCredentialId,
nsTArray<uint8_t>& aSigBuffer);
void RequestAborted(const nsresult& aError);
void Cancel(const nsresult& aError);
// nsIIPCbackgroundChildCreateCallback methods
void ActorCreated(PBackgroundChild* aActor) override;
void ActorFailed() override;
void ActorDestroyed();
private:
U2FManager();
virtual ~U2FManager();
void StartRegister();
void StartSign();
void StartCancel();
void MaybeClearTransaction();
nsresult PopulateTransactionInfo(const nsCString& aRpId,
const nsCString& aClientDataJSON,

Просмотреть файл

@ -68,9 +68,19 @@ class WebAuthnManager final : public nsIIPCBackgroundChildCreateCallback,
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
static WebAuthnManager* GetOrCreate();
static WebAuthnManager* Get();
already_AddRefed<Promise>
MakeCredential(nsPIDOMWindowInner* aParent,
const MakePublicKeyCredentialOptions& aOptions);
already_AddRefed<Promise>
GetAssertion(nsPIDOMWindowInner* aParent,
const PublicKeyCredentialRequestOptions& aOptions);
void
FinishMakeCredential(nsTArray<uint8_t>& aRegBuffer);
@ -81,26 +91,16 @@ public:
void
RequestAborted(const nsresult& aError);
already_AddRefed<Promise>
MakeCredential(nsPIDOMWindowInner* aParent,
const MakePublicKeyCredentialOptions& aOptions);
void ActorDestroyed();
already_AddRefed<Promise>
GetAssertion(nsPIDOMWindowInner* aParent,
const PublicKeyCredentialRequestOptions& aOptions);
private:
WebAuthnManager();
virtual ~WebAuthnManager();
void StartRegister();
void StartSign();
void StartCancel();
// nsIIPCbackgroundChildCreateCallback methods
void ActorCreated(PBackgroundChild* aActor) override;
void ActorFailed() override;
void ActorDestroyed();
private:
WebAuthnManager();
virtual ~WebAuthnManager();
void Cancel(const nsresult& aError);
void MaybeClearTransaction();