webauthn_request_registrar_impl.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2020 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. #ifndef ASH_IN_SESSION_AUTH_WEBAUTHN_REQUEST_REGISTRAR_IMPL_H_
  5. #define ASH_IN_SESSION_AUTH_WEBAUTHN_REQUEST_REGISTRAR_IMPL_H_
  6. #include <string>
  7. #include "base/callback_forward.h"
  8. #include "chromeos/components/webauthn/webauthn_request_registrar.h"
  9. #include "ui/aura/window_tracker.h"
  10. namespace aura {
  11. class Window;
  12. }
  13. namespace ash {
  14. // WebAuthnRequestRegistrarImpl persists as long as UI is running.
  15. class WebAuthnRequestRegistrarImpl
  16. : public chromeos::webauthn::WebAuthnRequestRegistrar {
  17. public:
  18. WebAuthnRequestRegistrarImpl();
  19. WebAuthnRequestRegistrarImpl(const WebAuthnRequestRegistrarImpl&) = delete;
  20. WebAuthnRequestRegistrarImpl& operator=(const WebAuthnRequestRegistrarImpl&) =
  21. delete;
  22. ~WebAuthnRequestRegistrarImpl() override;
  23. // WebAuthnRequestRegistrar:
  24. GenerateRequestIdCallback GetRegisterCallback(aura::Window* window) override;
  25. aura::Window* GetWindowForRequestId(std::string request_id) override;
  26. private:
  27. std::string DoRegister(aura::Window* window);
  28. SEQUENCE_CHECKER(sequence_checker_);
  29. aura::WindowTracker window_tracker_;
  30. };
  31. } // namespace ash
  32. #endif // ASH_IN_SESSION_AUTH_WEBAUTHN_REQUEST_REGISTRAR_IMPL_H_