OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 COMPONENTS_WEBAUTH_AUTHENTICATOR_IMPL_H_ | |
6 #define COMPONENTS_WEBAUTH_AUTHENTICATOR_IMPL_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/macros.h" | |
11 #include "components/webauth/authenticator.mojom.h" | |
12 #include "content/public/browser/web_contents.h" | |
13 #include "mojo/public/cpp/bindings/binding.h" | |
14 #include "mojo/public/cpp/bindings/interface_request.h" | |
15 | |
16 namespace content { | |
17 class RenderFrameHost; | |
18 } | |
19 | |
20 namespace webauth { | |
21 | |
22 // Implementation of the public Authenticator interface. | |
23 class AuthenticatorImpl : public mojom::Authenticator { | |
24 public: | |
25 static void Create(content::RenderFrameHost* render_frame_host, | |
26 mojo::InterfaceRequest<mojom::Authenticator> request); | |
27 ~AuthenticatorImpl() override; | |
28 | |
29 void set_connection_error_handler(const base::Closure& error_handler) { | |
30 connection_error_handler_ = error_handler; | |
31 } | |
32 | |
33 private: | |
34 AuthenticatorImpl(content::RenderFrameHost* render_frame_host); | |
35 | |
36 // mojom:Authenticator | |
37 void MakeCredential( | |
38 mojom::RelyingPartyAccountPtr account, | |
39 std::vector<mojom::ScopedCredentialParametersPtr> parameters, | |
40 const std::vector<uint8_t>& challenge, | |
41 mojom::ScopedCredentialOptionsPtr options, | |
42 MakeCredentialCallback callback) override; | |
43 | |
44 // Callback to handle the async response from a U2fDevice. | |
45 void OnRegister(MakeCredentialCallback callback, | |
46 std::string& clientDataJSON, | |
47 uint8_t status_code, | |
48 std::vector<uint8_t> data); | |
49 | |
50 void OnTimeout(MakeCredentialCallback callback); | |
51 | |
52 // As a result of a browser-side error or renderer-initiated mojo channel | |
53 // closure (e.g. there was an error on the renderer side, or payment was | |
54 // successful), this method is called. It is responsible for cleaning up. | |
55 void OnConnectionTerminated(); | |
56 | |
57 base::Closure connection_error_handler_; | |
58 base::CancelableClosure timeout_callback_; | |
59 url::Origin callerOrigin_; | |
jochen (gone - plz use gerrit)
2017/05/30 12:03:03
nit caller_origin_
kpaulhamus
2017/05/31 20:56:05
Done.
| |
60 DISALLOW_COPY_AND_ASSIGN(AuthenticatorImpl); | |
61 }; | |
62 | |
63 } // namespace webauth | |
64 | |
65 #endif // COMPONENTS_WEBAUTH_AUTHENTICATOR_IMPL_H_ | |
OLD | NEW |