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 "platform/credentialmanager/PlatformCredential.h" | 9 #include "platform/credentialmanager/PlatformCredential.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 #include "platform/weborigin/KURL.h" | 11 #include "platform/weborigin/KURL.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class ExceptionState; | 15 class ExceptionState; |
16 | 16 |
17 class Credential : public GarbageCollected<Credential>, public ScriptWrappable { | 17 class Credential : public GarbageCollected<Credential>, public ScriptWrappable { |
18 DEFINE_WRAPPERTYPEINFO(); | 18 DEFINE_WRAPPERTYPEINFO(); |
19 public: | 19 public: |
20 static Credential* create(const String& id, const String& name, const KURL&
icon); | |
21 static Credential* create(const String& id, const String& name, const String
& icon, ExceptionState&); | |
22 | |
23 // Credential.idl | 20 // Credential.idl |
24 const String& id() const { return m_platformCredential->id(); } | 21 const String& id() const { return m_platformCredential->id(); } |
25 const String& name() const { return m_platformCredential->name(); } | 22 const String& name() const { return m_platformCredential->name(); } |
26 const KURL& iconURL() const { return m_platformCredential->iconURL(); } | 23 const KURL& iconURL() const { return m_platformCredential->iconURL(); } |
27 const String& type() const { return m_platformCredential->type(); } | 24 const String& type() const { return m_platformCredential->type(); } |
28 | 25 |
29 DECLARE_VIRTUAL_TRACE(); | 26 DECLARE_VIRTUAL_TRACE(); |
30 | 27 |
31 PlatformCredential* platformCredential() const { return m_platformCredential
; } | 28 PlatformCredential* platformCredential() const { return m_platformCredential
; } |
32 | 29 |
33 protected: | 30 protected: |
34 Credential(PlatformCredential*); | 31 Credential(PlatformCredential*); |
35 Credential(const String& id, const String& name, const KURL& icon); | 32 Credential(const String& id, const String& name, const KURL& icon); |
36 | 33 |
37 // Parses a string as a KURL. Throws an exception via |exceptionState| if an
invalid URL is produced. | 34 // Parses a string as a KURL. Throws an exception via |exceptionState| if an
invalid URL is produced. |
38 static KURL parseStringAsURL(const String&, ExceptionState&); | 35 static KURL parseStringAsURL(const String&, ExceptionState&); |
39 | 36 |
40 Member<PlatformCredential> m_platformCredential; | 37 Member<PlatformCredential> m_platformCredential; |
41 }; | 38 }; |
42 | 39 |
43 } // namespace blink | 40 } // namespace blink |
44 | 41 |
45 #endif // Credential_h | 42 #endif // Credential_h |
OLD | NEW |