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 { |
| 34 DCHECK_EQ(m_type, ScopedCredentialType::SCOPEDCRED); |
| 35 return "ScopedCred"; |
| 36 } |
| 37 |
| 38 DOMArrayBuffer* id() const { return m_id.get(); } |
| 39 |
| 40 ScopedCredentialType stringToCredentialType(const String& type) { |
| 41 // There is currently only one type |
| 42 return ScopedCredentialType::SCOPEDCRED; |
| 43 } |
| 44 |
| 45 DEFINE_INLINE_TRACE() { visitor->trace(m_id); } |
| 46 |
| 47 private: |
| 48 const ScopedCredentialType m_type; |
| 49 const Member<DOMArrayBuffer> m_id; |
| 50 }; |
| 51 |
| 52 } // namespace blink |
| 53 |
| 54 #endif // ScopedCredential_h |
OLD | NEW |