| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/password_manager/content/common/credential_manager_content_
utils.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "third_party/WebKit/public/platform/WebCredential.h" | |
| 9 #include "third_party/WebKit/public/platform/WebFederatedCredential.h" | |
| 10 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" | |
| 11 | |
| 12 namespace password_manager { | |
| 13 | |
| 14 CredentialInfo WebCredentialToCredentialInfo( | |
| 15 const blink::WebCredential& credential) { | |
| 16 CredentialInfo credential_info; | |
| 17 credential_info.id = credential.id(); | |
| 18 credential_info.name = credential.name(); | |
| 19 credential_info.icon = credential.iconURL(); | |
| 20 credential_info.type = credential.isPasswordCredential() | |
| 21 ? CredentialType::CREDENTIAL_TYPE_PASSWORD | |
| 22 : CredentialType::CREDENTIAL_TYPE_FEDERATED; | |
| 23 if (credential_info.type == CredentialType::CREDENTIAL_TYPE_PASSWORD) { | |
| 24 DCHECK(credential.isPasswordCredential()); | |
| 25 credential_info.password = | |
| 26 static_cast<const blink::WebPasswordCredential&>(credential).password(); | |
| 27 } else { | |
| 28 DCHECK(credential.isFederatedCredential()); | |
| 29 credential_info.federation = | |
| 30 static_cast<const blink::WebFederatedCredential&>(credential) | |
| 31 .provider(); | |
| 32 } | |
| 33 return credential_info; | |
| 34 } | |
| 35 | |
| 36 } // namespace password_manager | |
| OLD | NEW |