| 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/metrics/user_metrics.h" |
| 10 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 12 #include "components/autofill/core/common/password_form.h" | 13 #include "components/autofill/core/common/password_form.h" |
| 13 #include "components/password_manager/content/browser/content_password_manager_d
river.h" | 14 #include "components/password_manager/content/browser/content_password_manager_d
river.h" |
| 14 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" | 15 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" |
| 15 #include "components/password_manager/content/public/cpp/type_converters.h" | 16 #include "components/password_manager/content/public/cpp/type_converters.h" |
| 16 #include "components/password_manager/core/browser/affiliated_match_helper.h" | 17 #include "components/password_manager/core/browser/affiliated_match_helper.h" |
| 17 #include "components/password_manager/core/browser/password_manager_client.h" | 18 #include "components/password_manager/core/browser/password_manager_client.h" |
| 18 #include "components/password_manager/core/browser/password_store.h" | 19 #include "components/password_manager/core/browser/password_store.h" |
| 19 #include "components/password_manager/core/common/credential_manager_types.h" | 20 #include "components/password_manager/core/common/credential_manager_types.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 : CredentialType::CREDENTIAL_TYPE_FEDERATED; | 244 : CredentialType::CREDENTIAL_TYPE_FEDERATED; |
| 244 info = CredentialInfo(*form, type_to_return); | 245 info = CredentialInfo(*form, type_to_return); |
| 245 if (PasswordStore* store = GetPasswordStore()) { | 246 if (PasswordStore* store = GetPasswordStore()) { |
| 246 if (form->skip_zero_click && IsZeroClickAllowed()) { | 247 if (form->skip_zero_click && IsZeroClickAllowed()) { |
| 247 DCHECK(IsUpdatingCredentialAllowed()); | 248 DCHECK(IsUpdatingCredentialAllowed()); |
| 248 autofill::PasswordForm update_form = *form; | 249 autofill::PasswordForm update_form = *form; |
| 249 update_form.skip_zero_click = false; | 250 update_form.skip_zero_click = false; |
| 250 store->UpdateLogin(update_form); | 251 store->UpdateLogin(update_form); |
| 251 } | 252 } |
| 252 } | 253 } |
| 254 base::RecordAction( |
| 255 base::UserMetricsAction("CredentialManager_AccountChooser_Accepted")); |
| 256 } else { |
| 257 base::RecordAction( |
| 258 base::UserMetricsAction("CredentialManager_AccountChooser_Dismissed")); |
| 253 } | 259 } |
| 254 SendCredential(send_callback, info); | 260 SendCredential(send_callback, info); |
| 255 } | 261 } |
| 256 | 262 |
| 257 PasswordManagerClient* CredentialManagerImpl::client() const { | 263 PasswordManagerClient* CredentialManagerImpl::client() const { |
| 258 return client_; | 264 return client_; |
| 259 } | 265 } |
| 260 | 266 |
| 261 autofill::PasswordForm CredentialManagerImpl::GetSynthesizedFormForOrigin() | 267 autofill::PasswordForm CredentialManagerImpl::GetSynthesizedFormForOrigin() |
| 262 const { | 268 const { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 273 DCHECK(pending_require_user_mediation_); | 279 DCHECK(pending_require_user_mediation_); |
| 274 pending_require_user_mediation_.reset(); | 280 pending_require_user_mediation_.reset(); |
| 275 } | 281 } |
| 276 | 282 |
| 277 bool CredentialManagerImpl::IsUpdatingCredentialAllowed() const { | 283 bool CredentialManagerImpl::IsUpdatingCredentialAllowed() const { |
| 278 return !client_->DidLastPageLoadEncounterSSLErrors() && | 284 return !client_->DidLastPageLoadEncounterSSLErrors() && |
| 279 !client_->IsOffTheRecord(); | 285 !client_->IsOffTheRecord(); |
| 280 } | 286 } |
| 281 | 287 |
| 282 } // namespace password_manager | 288 } // namespace password_manager |
| OLD | NEW |