| 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/browser/credential_manager_impl.h" | 5 #include "components/password_manager/content/browser/credential_manager_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // an exactly matching origin and username. In order to avoid showing a save | 97 // an exactly matching origin and username. In order to avoid showing a save |
| 98 // bubble to the user Save() is called directly. | 98 // bubble to the user Save() is called directly. |
| 99 form_manager_->Save(); | 99 form_manager_->Save(); |
| 100 return; | 100 return; |
| 101 } | 101 } |
| 102 | 102 |
| 103 if (!form.federation_origin.unique()) { | 103 if (!form.federation_origin.unique()) { |
| 104 // If this is a federated credential, check it against the federated matches | 104 // If this is a federated credential, check it against the federated matches |
| 105 // produced by the PasswordFormManager. If a match is found, update it and | 105 // produced by the PasswordFormManager. If a match is found, update it and |
| 106 // return. | 106 // return. |
| 107 for (const auto& match : | 107 for (auto* match : form_manager_->form_fetcher()->GetFederatedMatches()) { |
| 108 form_manager_->form_fetcher()->GetFederatedMatches()) { | |
| 109 if (match->username_value == form.username_value && | 108 if (match->username_value == form.username_value && |
| 110 match->federation_origin.IsSameOriginWith(form.federation_origin)) { | 109 match->federation_origin.IsSameOriginWith(form.federation_origin)) { |
| 111 form_manager_->Update(*match); | 110 form_manager_->Update(*match); |
| 112 return; | 111 return; |
| 113 } | 112 } |
| 114 } | 113 } |
| 115 } else if (!form_manager_->IsNewLogin()) { | 114 } else if (!form_manager_->IsNewLogin()) { |
| 116 // Otherwise, if this is not a new password credential, update the existing | 115 // Otherwise, if this is not a new password credential, update the existing |
| 117 // credential without prompting the user. This will also update the | 116 // credential without prompting the user. This will also update the |
| 118 // 'skip_zero_click' state, as we've gotten an explicit signal that the page | 117 // 'skip_zero_click' state, as we've gotten an explicit signal that the page |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 PasswordStore::FormDigest CredentialManagerImpl::GetSynthesizedFormForOrigin() | 280 PasswordStore::FormDigest CredentialManagerImpl::GetSynthesizedFormForOrigin() |
| 282 const { | 281 const { |
| 283 PasswordStore::FormDigest digest = { | 282 PasswordStore::FormDigest digest = { |
| 284 autofill::PasswordForm::SCHEME_HTML, std::string(), | 283 autofill::PasswordForm::SCHEME_HTML, std::string(), |
| 285 web_contents()->GetLastCommittedURL().GetOrigin()}; | 284 web_contents()->GetLastCommittedURL().GetOrigin()}; |
| 286 digest.signon_realm = digest.origin.spec(); | 285 digest.signon_realm = digest.origin.spec(); |
| 287 return digest; | 286 return digest; |
| 288 } | 287 } |
| 289 | 288 |
| 290 } // namespace password_manager | 289 } // namespace password_manager |
| OLD | NEW |