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 #include "config.h" | 5 #include "config.h" |
6 #include "modules/credentialmanager/PasswordCredential.h" | 6 #include "modules/credentialmanager/PasswordCredential.h" |
7 | 7 |
8 #include "bindings/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" |
9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
11 #include "core/html/DOMFormData.h" | 11 #include "core/html/DOMFormData.h" |
12 #include "modules/credentialmanager/FormDataOptions.h" | 12 #include "modules/credentialmanager/FormDataOptions.h" |
| 13 #include "modules/credentialmanager/PasswordCredentialData.h" |
13 #include "platform/credentialmanager/PlatformPasswordCredential.h" | 14 #include "platform/credentialmanager/PlatformPasswordCredential.h" |
14 #include "platform/weborigin/SecurityOrigin.h" | 15 #include "platform/weborigin/SecurityOrigin.h" |
15 #include "public/platform/WebCredential.h" | 16 #include "public/platform/WebCredential.h" |
16 #include "public/platform/WebPasswordCredential.h" | 17 #include "public/platform/WebPasswordCredential.h" |
17 | 18 |
18 namespace blink { | 19 namespace blink { |
19 | 20 |
20 PasswordCredential* PasswordCredential::create(WebPasswordCredential* webPasswor
dCredential) | 21 PasswordCredential* PasswordCredential::create(WebPasswordCredential* webPasswor
dCredential) |
21 { | 22 { |
22 return new PasswordCredential(webPasswordCredential); | 23 return new PasswordCredential(webPasswordCredential); |
23 } | 24 } |
24 | 25 |
25 PasswordCredential* PasswordCredential::create(const String& id, const String& p
assword, const String& name, const String& icon, ExceptionState& exceptionState) | 26 PasswordCredential* PasswordCredential::create(const PasswordCredentialData& dat
a, ExceptionState& exceptionState) |
26 { | 27 { |
27 KURL iconURL = parseStringAsURL(icon, exceptionState); | 28 KURL iconURL = parseStringAsURL(data.iconURL(), exceptionState); |
28 if (exceptionState.hadException()) | 29 if (exceptionState.hadException()) |
29 return nullptr; | 30 return nullptr; |
30 return new PasswordCredential(id, password, name, iconURL); | 31 return new PasswordCredential(data.id(), data.password(), data.name(), iconU
RL); |
31 } | 32 } |
32 | 33 |
33 PasswordCredential::PasswordCredential(WebPasswordCredential* webPasswordCredent
ial) | 34 PasswordCredential::PasswordCredential(WebPasswordCredential* webPasswordCredent
ial) |
34 : Credential(webPasswordCredential->platformCredential()) | 35 : Credential(webPasswordCredential->platformCredential()) |
35 { | 36 { |
36 } | 37 } |
37 | 38 |
38 PasswordCredential::PasswordCredential(const String& id, const String& password,
const String& name, const KURL& icon) | 39 PasswordCredential::PasswordCredential(const String& id, const String& password,
const String& name, const KURL& icon) |
39 : Credential(PlatformPasswordCredential::create(id, password, name, icon)) | 40 : Credential(PlatformPasswordCredential::create(id, password, name, icon)) |
40 { | 41 { |
(...skipping 17 matching lines...) Expand all Loading... |
58 { | 59 { |
59 return static_cast<PlatformPasswordCredential*>(m_platformCredential.get())-
>password(); | 60 return static_cast<PlatformPasswordCredential*>(m_platformCredential.get())-
>password(); |
60 } | 61 } |
61 | 62 |
62 DEFINE_TRACE(PasswordCredential) | 63 DEFINE_TRACE(PasswordCredential) |
63 { | 64 { |
64 Credential::trace(visitor); | 65 Credential::trace(visitor); |
65 } | 66 } |
66 | 67 |
67 } // namespace blink | 68 } // namespace blink |
OLD | NEW |