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/FormData.h" |
12 #include "modules/credentialmanager/FormDataOptions.h" | 12 #include "modules/credentialmanager/FormDataOptions.h" |
13 #include "modules/credentialmanager/PasswordCredentialData.h" | 13 #include "modules/credentialmanager/PasswordCredentialData.h" |
14 #include "platform/credentialmanager/PlatformPasswordCredential.h" | 14 #include "platform/credentialmanager/PlatformPasswordCredential.h" |
15 #include "platform/weborigin/SecurityOrigin.h" | 15 #include "platform/weborigin/SecurityOrigin.h" |
16 #include "public/platform/WebCredential.h" | 16 #include "public/platform/WebCredential.h" |
17 #include "public/platform/WebPasswordCredential.h" | 17 #include "public/platform/WebPasswordCredential.h" |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
21 PasswordCredential* PasswordCredential::create(WebPasswordCredential* webPasswor
dCredential) | 21 PasswordCredential* PasswordCredential::create(WebPasswordCredential* webPasswor
dCredential) |
(...skipping 12 matching lines...) Expand all Loading... |
34 PasswordCredential::PasswordCredential(WebPasswordCredential* webPasswordCredent
ial) | 34 PasswordCredential::PasswordCredential(WebPasswordCredential* webPasswordCredent
ial) |
35 : Credential(webPasswordCredential->platformCredential()) | 35 : Credential(webPasswordCredential->platformCredential()) |
36 { | 36 { |
37 } | 37 } |
38 | 38 |
39 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) |
40 : Credential(PlatformPasswordCredential::create(id, password, name, icon)) | 40 : Credential(PlatformPasswordCredential::create(id, password, name, icon)) |
41 { | 41 { |
42 } | 42 } |
43 | 43 |
44 DOMFormData* PasswordCredential::toFormData(ScriptState* scriptState, const Form
DataOptions& options) | 44 FormData* PasswordCredential::toFormData(ScriptState* scriptState, const FormDat
aOptions& options) |
45 { | 45 { |
46 DOMFormData* fd = DOMFormData::create(); | 46 FormData* fd = FormData::create(); |
47 | 47 |
48 String errorMessage; | 48 String errorMessage; |
49 if (!scriptState->executionContext()->isPrivilegedContext(errorMessage)) | 49 if (!scriptState->executionContext()->isPrivilegedContext(errorMessage)) |
50 return fd; | 50 return fd; |
51 | 51 |
52 fd->append(options.idName(), id()); | 52 fd->append(options.idName(), id()); |
53 fd->append(options.passwordName(), password()); | 53 fd->append(options.passwordName(), password()); |
54 fd->makeOpaque(); | 54 fd->makeOpaque(); |
55 return fd; | 55 return fd; |
56 } | 56 } |
57 | 57 |
58 const String& PasswordCredential::password() const | 58 const String& PasswordCredential::password() const |
59 { | 59 { |
60 return static_cast<PlatformPasswordCredential*>(m_platformCredential.get())-
>password(); | 60 return static_cast<PlatformPasswordCredential*>(m_platformCredential.get())-
>password(); |
61 } | 61 } |
62 | 62 |
63 DEFINE_TRACE(PasswordCredential) | 63 DEFINE_TRACE(PasswordCredential) |
64 { | 64 { |
65 Credential::trace(visitor); | 65 Credential::trace(visitor); |
66 } | 66 } |
67 | 67 |
68 } // namespace blink | 68 } // namespace blink |
OLD | NEW |