1 // Copyright 2019 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 
5 #ifndef CONTENT_BROWSER_WEBAUTH_VIRTUAL_AUTHENTICATOR_REQUEST_DELEGATE_H_
6 #define CONTENT_BROWSER_WEBAUTH_VIRTUAL_AUTHENTICATOR_REQUEST_DELEGATE_H_
7 
8 #include "base/callback_forward.h"
9 #include "content/public/browser/authenticator_request_client_delegate.h"
10 
11 namespace content {
12 
13 class FrameTreeNode;
14 
15 // An implementation of AuthenticatorRequestClientDelegate that allows
16 // automating webauthn requests through a virtual environment.
17 class VirtualAuthenticatorRequestDelegate
18     : public AuthenticatorRequestClientDelegate {
19  public:
20   // The |frame_tree_node| must outlive this instance.
21   explicit VirtualAuthenticatorRequestDelegate(FrameTreeNode* frame_tree_node);
22   ~VirtualAuthenticatorRequestDelegate() override;
23 
24   // AuthenticatorRequestClientDelegate:
25   bool SupportsResidentKeys() override;
26   void SelectAccount(
27       std::vector<device::AuthenticatorGetAssertionResponse> responses,
28       base::OnceCallback<void(device::AuthenticatorGetAssertionResponse)>
29           callback) override;
30   base::Optional<bool> IsUserVerifyingPlatformAuthenticatorAvailableOverride()
31       override;
32 
33  private:
34   FrameTreeNode* const frame_tree_node_;
35 
36   DISALLOW_COPY_AND_ASSIGN(VirtualAuthenticatorRequestDelegate);
37 };
38 
39 }  // namespace content
40 
41 #endif  // CONTENT_BROWSER_WEBAUTH_VIRTUAL_AUTHENTICATOR_REQUEST_DELEGATE_H_
42