| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_content_
utils.h" | 5 #include "components/password_manager/content/common/credential_manager_content_
utils.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/WebKit/public/platform/WebCredential.h" | 8 #include "third_party/WebKit/public/platform/WebCredential.h" |
| 9 #include "third_party/WebKit/public/platform/WebFederatedCredential.h" | 9 #include "third_party/WebKit/public/platform/WebFederatedCredential.h" |
| 10 #include "third_party/WebKit/public/platform/WebLocalCredential.h" | 10 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" |
| 11 | 11 |
| 12 namespace password_manager { | 12 namespace password_manager { |
| 13 | 13 |
| 14 CredentialInfo WebCredentialToCredentialInfo( | 14 CredentialInfo WebCredentialToCredentialInfo( |
| 15 const blink::WebCredential& credential) { | 15 const blink::WebCredential& credential) { |
| 16 CredentialInfo credential_info; | 16 CredentialInfo credential_info; |
| 17 credential_info.id = credential.id(); | 17 credential_info.id = credential.id(); |
| 18 credential_info.name = credential.name(); | 18 credential_info.name = credential.name(); |
| 19 credential_info.avatar = credential.avatarURL(); | 19 credential_info.avatar = credential.avatarURL(); |
| 20 credential_info.type = credential.isLocalCredential() | 20 credential_info.type = credential.isPasswordCredential() |
| 21 ? CredentialType::CREDENTIAL_TYPE_LOCAL | 21 ? CredentialType::CREDENTIAL_TYPE_PASSWORD |
| 22 : CredentialType::CREDENTIAL_TYPE_FEDERATED; | 22 : CredentialType::CREDENTIAL_TYPE_FEDERATED; |
| 23 if (credential_info.type == CredentialType::CREDENTIAL_TYPE_LOCAL) { | 23 if (credential_info.type == CredentialType::CREDENTIAL_TYPE_PASSWORD) { |
| 24 DCHECK(credential.isLocalCredential()); | 24 DCHECK(credential.isPasswordCredential()); |
| 25 credential_info.password = | 25 credential_info.password = |
| 26 static_cast<const blink::WebLocalCredential&>(credential).password(); | 26 static_cast<const blink::WebPasswordCredential&>(credential).password(); |
| 27 } else { | 27 } else { |
| 28 DCHECK(credential.isFederatedCredential()); | 28 DCHECK(credential.isFederatedCredential()); |
| 29 credential_info.federation = | 29 credential_info.federation = |
| 30 static_cast<const blink::WebFederatedCredential&>(credential) | 30 static_cast<const blink::WebFederatedCredential&>(credential) |
| 31 .federation(); | 31 .federation(); |
| 32 } | 32 } |
| 33 return credential_info; | 33 return credential_info; |
| 34 } | 34 } |
| 35 | 35 |
| 36 } // namespace password_manager | 36 } // namespace password_manager |
| OLD | NEW |