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/core/common/credential_manager_types.h" | 5 #include "components/password_manager/core/common/credential_manager_types.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "components/autofill/core/common/password_form.h" | 8 #include "components/autofill/core/common/password_form.h" |
9 | 9 |
10 namespace password_manager { | 10 namespace password_manager { |
11 | 11 |
12 std::ostream& operator<<(std::ostream& out, CredentialType type) { | 12 std::ostream& operator<<(std::ostream& os, CredentialType value) { |
13 return out << static_cast<int>(type); | 13 switch (value) { |
| 14 case CredentialType::CREDENTIAL_TYPE_EMPTY: |
| 15 return os << "CredentialType::CREDENTIAL_TYPE_EMPTY"; |
| 16 case CredentialType::CREDENTIAL_TYPE_PASSWORD: |
| 17 return os << "CredentialType::CREDENTIAL_TYPE_PASSWORD"; |
| 18 case CredentialType::CREDENTIAL_TYPE_FEDERATED: |
| 19 return os << "CredentialType::CREDENTIAL_TYPE_FEDERATED"; |
| 20 } |
| 21 return os << "Unknown CredentialType value: " << static_cast<int32_t>(value); |
14 } | 22 } |
15 | 23 |
16 CredentialInfo::CredentialInfo() : type(CredentialType::CREDENTIAL_TYPE_EMPTY) { | 24 CredentialInfo::CredentialInfo() : type(CredentialType::CREDENTIAL_TYPE_EMPTY) { |
17 } | 25 } |
18 | 26 |
19 CredentialInfo::CredentialInfo(const autofill::PasswordForm& form, | 27 CredentialInfo::CredentialInfo(const autofill::PasswordForm& form, |
20 CredentialType form_type) | 28 CredentialType form_type) |
21 : type(form_type), | 29 : type(form_type), |
22 id(form.username_value), | 30 id(form.username_value), |
23 name(form.display_name), | 31 name(form.display_name), |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 form->username_value = info.id; | 75 form->username_value = info.id; |
68 return form; | 76 return form; |
69 } | 77 } |
70 bool CredentialInfo::operator==(const CredentialInfo& rhs) const { | 78 bool CredentialInfo::operator==(const CredentialInfo& rhs) const { |
71 return (type == rhs.type && id == rhs.id && name == rhs.name && | 79 return (type == rhs.type && id == rhs.id && name == rhs.name && |
72 icon == rhs.icon && password == rhs.password && | 80 icon == rhs.icon && password == rhs.password && |
73 federation.Serialize() == rhs.federation.Serialize()); | 81 federation.Serialize() == rhs.federation.Serialize()); |
74 } | 82 } |
75 | 83 |
76 } // namespace password_manager | 84 } // namespace password_manager |
OLD | NEW |