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 "components/password_manager/content/common/credential_manager_types.h" | 5 #include "components/password_manager/content/common/credential_manager_types.h" |
6 | 6 |
| 7 #include "base/logging.h" |
| 8 #include "components/autofill/core/common/password_form.h" |
| 9 |
7 namespace password_manager { | 10 namespace password_manager { |
8 | 11 |
9 CredentialInfo::CredentialInfo() : type(CREDENTIAL_TYPE_UNKNOWN) { | 12 CredentialInfo::CredentialInfo() : type(CREDENTIAL_TYPE_UNKNOWN) { |
10 } | 13 } |
11 | 14 |
12 CredentialInfo::CredentialInfo(const base::string16& id, | 15 CredentialInfo::CredentialInfo(const base::string16& id, |
13 const base::string16& name, | 16 const base::string16& name, |
14 const GURL& avatar) | 17 const GURL& avatar) |
15 : type(CREDENTIAL_TYPE_UNKNOWN), | 18 : type(CREDENTIAL_TYPE_UNKNOWN), |
16 id(id), | 19 id(id), |
17 name(name), | 20 name(name), |
18 avatar(avatar) { | 21 avatar(avatar) { |
19 } | 22 } |
20 | 23 |
| 24 CredentialInfo::CredentialInfo(const autofill::PasswordForm& form) |
| 25 : id(form.username_value), |
| 26 name(form.display_name), |
| 27 avatar(form.avatar_url), |
| 28 password(form.password_value), |
| 29 federation(form.federation_url) { |
| 30 DCHECK(!password.empty() || !federation.is_empty()); |
| 31 type = password.empty() ? CREDENTIAL_TYPE_FEDERATED : CREDENTIAL_TYPE_LOCAL; |
| 32 } |
| 33 |
21 CredentialInfo::~CredentialInfo() { | 34 CredentialInfo::~CredentialInfo() { |
22 } | 35 } |
23 | 36 |
24 } // namespace password_manager | 37 } // namespace password_manager |
OLD | NEW |