1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/CredentialChosenCallback.h"
8 #include "mozilla/dom/Credential.h"
12 using dom::Credential
;
15 nsresult
CredentialChosenCallback::Notify(const nsACString
& aCredentialId
) {
16 MOZ_ASSERT(NS_IsMainThread());
22 if (aCredentialId
.IsVoid()) {
23 mResult
->Reject(NS_OK
, __func__
);
28 for (auto option
: mOptions
) {
29 if (option
.id().Equals(NS_ConvertUTF8toUTF16(aCredentialId
))) {
30 mResult
->Resolve(option
, __func__
);
36 mResult
->Reject(nsresult::NS_ERROR_NO_CONTENT
, __func__
);
41 nsresult
CredentialChosenCallback::GetName(nsACString
& aName
) {
42 aName
.AssignLiteral("CredentialChosenCallback");
46 NS_IMPL_ISUPPORTS(CredentialChosenCallback
, nsICredentialChosenCallback
,
49 } // namespace mozilla