Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(849)

Side by Side Diff: third_party/WebKit/Source/modules/webauth/WebAuthentication.h

Issue 2702653002: Patch #1 of multiple. Add webauth .mojom and initial usage of makeCredential. (Closed)
Patch Set: Addressing more comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WebAuthentication_h 5 #ifndef WebAuthentication_h
6 #define WebAuthentication_h 6 #define WebAuthentication_h
7 7
8 #include "bindings/core/v8/ArrayBufferOrArrayBufferView.h" 8 #include "bindings/core/v8/ArrayBufferOrArrayBufferView.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptWrappable.h" 10 #include "bindings/core/v8/ScriptWrappable.h"
11 #include "components/webauth/authenticator.mojom-blink.h"
12 #include "core/dom/ContextLifecycleObserver.h"
11 #include "core/dom/DOMArrayBuffer.h" 13 #include "core/dom/DOMArrayBuffer.h"
12 #include "modules/webauth/AuthenticationAssertionOptions.h" 14 #include "modules/webauth/AuthenticationAssertionOptions.h"
13 #include "modules/webauth/RelyingPartyAccount.h" 15 #include "modules/webauth/ScopedCredentialInfo.h"
14 #include "modules/webauth/ScopedCredentialOptions.h"
15 #include "modules/webauth/ScopedCredentialParameters.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class LocalFrame;
20 class ScriptState;
21 class RelyingPartyAccount; 19 class RelyingPartyAccount;
22 class AuthenticationAssertionOptions; 20 class AuthenticationAssertionOptions;
21 class ScopedCredentialOptions;
23 class ScopedCredentialParameters; 22 class ScopedCredentialParameters;
24 class ScopedCredentialOptions; 23 class ScriptPromiseResolver;
25 24
26 typedef ArrayBufferOrArrayBufferView BufferSource; 25 typedef ArrayBufferOrArrayBufferView BufferSource;
27 26
28 class WebAuthentication final 27 class WebAuthentication final
29 : public GarbageCollectedFinalized<WebAuthentication>, 28 : public GarbageCollectedFinalized<WebAuthentication>,
30 public ScriptWrappable { 29 public ScriptWrappable,
30 public ContextLifecycleObserver {
31 DEFINE_WRAPPERTYPEINFO(); 31 DEFINE_WRAPPERTYPEINFO();
32 USING_GARBAGE_COLLECTED_MIXIN(WebAuthentication);
32 33
33 public: 34 public:
34 static WebAuthentication* Create(LocalFrame& frame) { 35 static WebAuthentication* Create(LocalFrame& frame) {
35 return new WebAuthentication(frame); 36 return new WebAuthentication(frame);
36 } 37 }
37 38
38 virtual ~WebAuthentication(); 39 virtual ~WebAuthentication();
39 40
40 void Dispose(); 41 void Dispose();
41 42
43 // WebAuthentication.idl
42 ScriptPromise makeCredential(ScriptState*, 44 ScriptPromise makeCredential(ScriptState*,
43 const RelyingPartyAccount&, 45 const RelyingPartyAccount&,
44 const HeapVector<ScopedCredentialParameters>, 46 const HeapVector<ScopedCredentialParameters>,
45 const BufferSource&, 47 const BufferSource&,
46 ScopedCredentialOptions&); 48 ScopedCredentialOptions&);
47 ScriptPromise getAssertion(ScriptState*, 49 ScriptPromise getAssertion(ScriptState*,
48 const BufferSource&, 50 const BufferSource&,
49 const AuthenticationAssertionOptions&); 51 const AuthenticationAssertionOptions&);
50 52
51 DEFINE_INLINE_TRACE() {} 53 // ContextLifecycleObserver overrides.
54 void ContextDestroyed(ExecutionContext*) override;
55
56 webauth::mojom::blink::Authenticator* authenticator() const {
dcheng 2017/04/25 12:52:14 Per the Blink style guide, these functions should
kpaulhamus 2017/05/03 17:00:45 Done.
57 return m_authenticator.get();
58 }
59
60 void onMakeCredential(ScriptPromiseResolver*,
61 Vector<webauth::mojom::blink::ScopedCredentialInfoPtr>);
62 bool markRequestComplete(ScriptPromiseResolver*);
63
64 void onAuthenticatorConnectionError();
65
66 DECLARE_VIRTUAL_TRACE();
52 67
53 private: 68 private:
54 explicit WebAuthentication(LocalFrame&); 69 explicit WebAuthentication(LocalFrame&);
70
71 webauth::mojom::blink::AuthenticatorPtr m_authenticator;
dcheng 2017/04/25 12:52:14 authenticator_, authenticator_requests_
kpaulhamus 2017/05/03 17:00:45 Done.
72 HeapHashSet<Member<ScriptPromiseResolver>> m_authenticatorRequests;
55 }; 73 };
56
57 } // namespace blink 74 } // namespace blink
58 75
59 #endif // WebAuthentication_h 76 #endif // WebAuthentication_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698