OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef Credential_h | 5 #ifndef Credential_h |
6 #define Credential_h | 6 #define Credential_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "bindings/core/v8/SerializedScriptValue.h" | 9 #include "bindings/core/v8/SerializedScriptValue.h" |
10 #include "platform/credentialmanager/PlatformCredential.h" | 10 #include "platform/credentialmanager/PlatformCredential.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "platform/weborigin/KURL.h" | 12 #include "platform/weborigin/KURL.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class WebCredential; | 16 class WebCredential; |
17 class ExceptionState; | 17 class ExceptionState; |
18 | 18 |
19 class Credential : public GarbageCollected<Credential>, public ScriptWrappable { | 19 class Credential : public GarbageCollected<Credential>, public ScriptWrappable { |
| 20 DEFINE_WRAPPERTYPEINFO(); |
20 public: | 21 public: |
21 static Credential* create(const String& id, const String& name, const KURL&
avatar); | 22 static Credential* create(const String& id, const String& name, const KURL&
avatar); |
22 static Credential* create(const String& id, const String& name, const String
& avatar, ExceptionState&); | 23 static Credential* create(const String& id, const String& name, const String
& avatar, ExceptionState&); |
23 | 24 |
24 // Credential.idl | 25 // Credential.idl |
25 const String& id() const { return m_platformCredential->id(); } | 26 const String& id() const { return m_platformCredential->id(); } |
26 const String& name() const { return m_platformCredential->name(); } | 27 const String& name() const { return m_platformCredential->name(); } |
27 const KURL& avatarURL() const { return m_platformCredential->avatarURL(); } | 28 const KURL& avatarURL() const { return m_platformCredential->avatarURL(); } |
28 | 29 |
29 virtual void trace(Visitor*); | 30 virtual void trace(Visitor*); |
30 | 31 |
31 protected: | 32 protected: |
32 explicit Credential(PlatformCredential*); | 33 explicit Credential(PlatformCredential*); |
33 Credential(const String& id, const String& name, const KURL& avatar); | 34 Credential(const String& id, const String& name, const KURL& avatar); |
34 | 35 |
35 // Parses a string as a KURL. Throws an exception via |exceptionState| if an
invalid URL is produced. | 36 // Parses a string as a KURL. Throws an exception via |exceptionState| if an
invalid URL is produced. |
36 static KURL parseStringAsURL(const String&, ExceptionState&); | 37 static KURL parseStringAsURL(const String&, ExceptionState&); |
37 | 38 |
38 Member<PlatformCredential> m_platformCredential; | 39 Member<PlatformCredential> m_platformCredential; |
39 }; | 40 }; |
40 | 41 |
41 } // namespace blink | 42 } // namespace blink |
42 | 43 |
43 #endif // Credential_h | 44 #endif // Credential_h |
OLD | NEW |