OLD | NEW |
---|---|
(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 { | |
esprehn
2017/01/19 01:58:59
If you make this return a StringView you can avoid
kpaulhamus
2017/01/19 23:25:34
Leaving as String, since setReturnValueFromString
| |
34 switch (m_type) { | |
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") | |
esprehn
2017/01/19 01:58:59
This is wasted work with the return below. Just ad
kpaulhamus
2017/01/19 23:25:34
Done.
| |
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 | |
OLD | NEW |