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

Side by Side Diff: third_party/WebKit/Source/modules/webauthentication/ScopedCredential.h

Issue 2533863002: Add WebAuthn bindings and client interface. (Closed)
Patch Set: Created 4 years 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
(Empty)
1 // Copyright 2016 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 ScopedCredential_h
6 #define ScopedCredential_h
7
8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/dom/DOMArrayBuffer.h"
10
11 namespace blink {
12
13 class ScopedCredentialType;
14
15 class ScopedCredential final
16 : public GarbageCollectedFinalized<ScopedCredential>,
17 public ScriptWrappable {
18 DEFINE_WRAPPERTYPEINFO();
19
20 public:
21 enum class ScopedCredentialType { SCOPEDCRED };
22
23 static ScopedCredential* create(const ScopedCredentialType type,
24 DOMArrayBuffer* id) {
25 return new ScopedCredential(type, id);
26 }
27
28 ScopedCredential(const ScopedCredentialType type, DOMArrayBuffer* id)
29 : m_type(type), m_id(id) {}
30
31 virtual ~ScopedCredential() {}
32
33 String type() const {
34 switch (m_type) {
esprehn 2017/01/19 01:58:59 DCHECK_EQ(m_type, ScopedCredentialType::SCOPEDCRED
kpaulhamus 2017/01/19 23:25:34 Done.
35 case ScopedCredentialType::SCOPEDCRED:
36 return "ScopedCred";
37 }
38
39 NOTREACHED();
40 return "";
41 }
42
43 DOMArrayBuffer* id() const { return m_id.get(); }
44
45 ScopedCredentialType stringToCredentialType(const String& type) {
46 if (type == "ScopedCred")
47 return ScopedCredentialType::SCOPEDCRED;
48 return ScopedCredentialType::SCOPEDCRED;
49 }
50
51 DEFINE_INLINE_TRACE() { visitor->trace(m_id); }
52
53 private:
54 const ScopedCredentialType m_type;
55 const Member<DOMArrayBuffer> m_id;
56 };
57
58 } // namespace blink
59
60 #endif // ScopedCredential_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698