| 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 "core/dom/DOMArrayBuffer.h" | |
| 9 #include "platform/bindings/ScriptWrappable.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 : type_(type), id_(id) {} | |
| 30 | |
| 31 virtual ~ScopedCredential() {} | |
| 32 | |
| 33 String type() const { | |
| 34 DCHECK_EQ(type_, ScopedCredentialType::SCOPEDCRED); | |
| 35 return "ScopedCred"; | |
| 36 } | |
| 37 | |
| 38 DOMArrayBuffer* id() const { return 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(id_); } | |
| 46 | |
| 47 private: | |
| 48 const ScopedCredentialType type_; | |
| 49 const Member<DOMArrayBuffer> id_; | |
| 50 }; | |
| 51 | |
| 52 } // namespace blink | |
| 53 | |
| 54 #endif // ScopedCredential_h | |
| OLD | NEW |