| 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_dispatc
her.h" | 5 #include "components/password_manager/content/browser/credential_manager_dispatc
her.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/autofill/core/common/password_form.h" | 12 #include "components/autofill/core/common/password_form.h" |
| 11 #include "components/password_manager/content/browser/content_password_manager_d
river.h" | 13 #include "components/password_manager/content/browser/content_password_manager_d
river.h" |
| 12 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" | 14 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" |
| 13 #include "components/password_manager/content/common/credential_manager_messages
.h" | 15 #include "components/password_manager/content/common/credential_manager_messages
.h" |
| 14 #include "components/password_manager/core/browser/affiliated_match_helper.h" | 16 #include "components/password_manager/core/browser/affiliated_match_helper.h" |
| 15 #include "components/password_manager/core/browser/password_manager_client.h" | 17 #include "components/password_manager/core/browser/password_manager_client.h" |
| 16 #include "components/password_manager/core/browser/password_store.h" | 18 #include "components/password_manager/core/browser/password_store.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 73 } |
| 72 | 74 |
| 73 void CredentialManagerDispatcher::OnProvisionalSaveComplete() { | 75 void CredentialManagerDispatcher::OnProvisionalSaveComplete() { |
| 74 DCHECK(form_manager_); | 76 DCHECK(form_manager_); |
| 75 DCHECK(client_->IsSavingAndFillingEnabledForCurrentPage()); | 77 DCHECK(client_->IsSavingAndFillingEnabledForCurrentPage()); |
| 76 | 78 |
| 77 if (form_manager_->IsNewLogin()) { | 79 if (form_manager_->IsNewLogin()) { |
| 78 // If the PasswordForm we were given does not match an existing | 80 // If the PasswordForm we were given does not match an existing |
| 79 // PasswordForm, ask the user if they'd like to save. | 81 // PasswordForm, ask the user if they'd like to save. |
| 80 client_->PromptUserToSaveOrUpdatePassword( | 82 client_->PromptUserToSaveOrUpdatePassword( |
| 81 form_manager_.Pass(), CredentialSourceType::CREDENTIAL_SOURCE_API, | 83 std::move(form_manager_), CredentialSourceType::CREDENTIAL_SOURCE_API, |
| 82 false); | 84 false); |
| 83 } else { | 85 } else { |
| 84 // Otherwise, update the existing form, as we've been told by the site | 86 // Otherwise, update the existing form, as we've been told by the site |
| 85 // that the new PasswordForm is a functioning credential for the user. | 87 // that the new PasswordForm is a functioning credential for the user. |
| 86 // We use 'PasswordFormManager::Update(PasswordForm&)' here rather than | 88 // We use 'PasswordFormManager::Update(PasswordForm&)' here rather than |
| 87 // 'PasswordFormManager::UpdateLogin', as we need to port over the | 89 // 'PasswordFormManager::UpdateLogin', as we need to port over the |
| 88 // 'skip_zero_click' state to ensure that we don't accidentally start | 90 // 'skip_zero_click' state to ensure that we don't accidentally start |
| 89 // signing users in just because the site asks us to. The simplest way | 91 // signing users in just because the site asks us to. The simplest way |
| 90 // to do so is simply to update the password field of the existing | 92 // to do so is simply to update the password field of the existing |
| 91 // credential. | 93 // credential. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 !client_->DidLastPageLoadEncounterSSLErrors(); | 255 !client_->DidLastPageLoadEncounterSSLErrors(); |
| 254 return synthetic_form; | 256 return synthetic_form; |
| 255 } | 257 } |
| 256 | 258 |
| 257 void CredentialManagerDispatcher::DoneRequiringUserMediation() { | 259 void CredentialManagerDispatcher::DoneRequiringUserMediation() { |
| 258 DCHECK(pending_require_user_mediation_); | 260 DCHECK(pending_require_user_mediation_); |
| 259 pending_require_user_mediation_.reset(); | 261 pending_require_user_mediation_.reset(); |
| 260 } | 262 } |
| 261 | 263 |
| 262 } // namespace password_manager | 264 } // namespace password_manager |
| OLD | NEW |