webauthn_client_android.cc 832 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/webauthn/android/webauthn_client_android.h"
  5. #include <memory>
  6. #include "base/check.h"
  7. namespace components {
  8. // The WebAuthnClientAndroid instance, which is set by the embedder.
  9. WebAuthnClientAndroid* g_webauthn_client = nullptr;
  10. WebAuthnClientAndroid::~WebAuthnClientAndroid() = default;
  11. // static
  12. void WebAuthnClientAndroid::SetClient(
  13. std::unique_ptr<WebAuthnClientAndroid> client) {
  14. DCHECK(client);
  15. DCHECK(!g_webauthn_client);
  16. g_webauthn_client = client.release();
  17. }
  18. // static
  19. WebAuthnClientAndroid* WebAuthnClientAndroid::GetClient() {
  20. DCHECK(g_webauthn_client);
  21. return g_webauthn_client;
  22. }
  23. } // namespace components