Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webauthentication/ScopedCredential.h |
| diff --git a/third_party/WebKit/Source/modules/webauthentication/ScopedCredential.h b/third_party/WebKit/Source/modules/webauthentication/ScopedCredential.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..50009147029ec17aebcb0d32b25325323e38bc81 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/webauthentication/ScopedCredential.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ScopedCredential_h |
| +#define ScopedCredential_h |
| + |
| +#include "bindings/core/v8/ScriptWrappable.h" |
| +#include "core/dom/DOMArrayBuffer.h" |
| + |
| +namespace blink { |
| + |
| +class ScopedCredentialType; |
| + |
| +class ScopedCredential final |
| + : public GarbageCollectedFinalized<ScopedCredential>, |
| + public ScriptWrappable { |
| + DEFINE_WRAPPERTYPEINFO(); |
| + |
| + public: |
| + enum class ScopedCredentialType { SCOPEDCRED }; |
| + |
| + static ScopedCredential* create(const ScopedCredentialType type, |
| + DOMArrayBuffer* id) { |
| + return new ScopedCredential(type, id); |
| + } |
| + |
| + ScopedCredential(const ScopedCredentialType type, DOMArrayBuffer* id) |
| + : m_type(type), m_id(id) {} |
| + |
| + virtual ~ScopedCredential() {} |
| + |
| + String type() const { |
| + switch (m_type) { |
|
esprehn
2017/01/19 01:58:59
DCHECK_EQ(m_type, ScopedCredentialType::SCOPEDCRED
kpaulhamus
2017/01/19 23:25:34
Done.
|
| + case ScopedCredentialType::SCOPEDCRED: |
| + return "ScopedCred"; |
| + } |
| + |
| + NOTREACHED(); |
| + return ""; |
| + } |
| + |
| + DOMArrayBuffer* id() const { return m_id.get(); } |
| + |
| + ScopedCredentialType stringToCredentialType(const String& type) { |
| + if (type == "ScopedCred") |
| + return ScopedCredentialType::SCOPEDCRED; |
| + return ScopedCredentialType::SCOPEDCRED; |
| + } |
| + |
| + DEFINE_INLINE_TRACE() { visitor->trace(m_id); } |
| + |
| + private: |
| + const ScopedCredentialType m_type; |
| + const Member<DOMArrayBuffer> m_id; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // ScopedCredential_h |