| 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 "chrome/browser/password_manager/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 DCHECK(!local_forms.empty()); | 317 DCHECK(!local_forms.empty()); |
| 318 #if BUILDFLAG(ANDROID_JAVA_UI) | 318 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 319 ShowAutoSigninPrompt(web_contents(), local_forms[0]->username_value); | 319 ShowAutoSigninPrompt(web_contents(), local_forms[0]->username_value); |
| 320 #else | 320 #else |
| 321 PasswordsClientUIDelegateFromWebContents(web_contents()) | 321 PasswordsClientUIDelegateFromWebContents(web_contents()) |
| 322 ->OnAutoSignin(std::move(local_forms)); | 322 ->OnAutoSignin(std::move(local_forms)); |
| 323 | 323 |
| 324 #endif | 324 #endif |
| 325 } | 325 } |
| 326 | 326 |
| 327 void ChromePasswordManagerClient::NotifyUserAutoSigninBlockedOnFirstRun( | 327 void ChromePasswordManagerClient::NotifyUserCouldBeAutoSignedIn( |
| 328 scoped_ptr<autofill::PasswordForm> form) { | 328 scoped_ptr<autofill::PasswordForm> form) { |
| 329 DCHECK( | 329 possible_auto_sign_in_ = std::move(form); |
| 330 password_bubble_experiment::ShouldShowAutoSignInPromptFirstRunExperience( | |
| 331 GetPrefs())); | |
| 332 form_blocked_on_first_run_ = std::move(form); | |
| 333 } | 330 } |
| 334 | 331 |
| 335 void ChromePasswordManagerClient::NotifySuccessfulLoginWithExistingPassword( | 332 void ChromePasswordManagerClient::NotifySuccessfulLoginWithExistingPassword( |
| 336 const autofill::PasswordForm& form) { | 333 const autofill::PasswordForm& form) { |
| 337 if (form.skip_zero_click && | 334 if (!possible_auto_sign_in_) |
| 338 credential_manager_dispatcher_.IsZeroClickAllowed() && | |
| 339 GetPasswordStore()) { | |
| 340 autofill::PasswordForm update(form); | |
| 341 update.skip_zero_click = false; | |
| 342 GetPasswordStore()->UpdateLogin(update); | |
| 343 } | |
| 344 | |
| 345 if (!form_blocked_on_first_run_) | |
| 346 return; | 335 return; |
| 347 | 336 |
| 348 if (form_blocked_on_first_run_->username_value == form.username_value && | 337 if (possible_auto_sign_in_->username_value == form.username_value && |
| 349 form_blocked_on_first_run_->password_value == form.password_value && | 338 possible_auto_sign_in_->password_value == form.password_value && |
| 350 form_blocked_on_first_run_->origin == form.origin) { | 339 possible_auto_sign_in_->origin == form.origin) { |
| 351 PromptUserToEnableAutosigninIfNecessary(); | 340 PromptUserToEnableAutosigninIfNecessary(); |
| 341 if (form.skip_zero_click && |
| 342 credential_manager_dispatcher_.IsZeroClickAllowed() && |
| 343 GetPasswordStore()) { |
| 344 autofill::PasswordForm update(form); |
| 345 update.skip_zero_click = false; |
| 346 GetPasswordStore()->UpdateLogin(update); |
| 347 } |
| 352 } | 348 } |
| 353 form_blocked_on_first_run_.reset(); | 349 possible_auto_sign_in_.reset(); |
| 354 } | 350 } |
| 355 | 351 |
| 356 void ChromePasswordManagerClient::AutomaticPasswordSave( | 352 void ChromePasswordManagerClient::AutomaticPasswordSave( |
| 357 scoped_ptr<password_manager::PasswordFormManager> saved_form) { | 353 scoped_ptr<password_manager::PasswordFormManager> saved_form) { |
| 358 #if BUILDFLAG(ANDROID_JAVA_UI) | 354 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 359 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); | 355 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); |
| 360 #else | 356 #else |
| 361 if (IsTheHotNewBubbleUIEnabled()) { | 357 if (IsTheHotNewBubbleUIEnabled()) { |
| 362 PasswordsClientUIDelegate* manage_passwords_ui_controller = | 358 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
| 363 PasswordsClientUIDelegateFromWebContents(web_contents()); | 359 PasswordsClientUIDelegateFromWebContents(web_contents()); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | 627 |
| 632 const password_manager::CredentialsFilter* | 628 const password_manager::CredentialsFilter* |
| 633 ChromePasswordManagerClient::GetStoreResultFilter() const { | 629 ChromePasswordManagerClient::GetStoreResultFilter() const { |
| 634 return &credentials_filter_; | 630 return &credentials_filter_; |
| 635 } | 631 } |
| 636 | 632 |
| 637 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 633 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
| 638 const { | 634 const { |
| 639 return log_manager_.get(); | 635 return log_manager_.get(); |
| 640 } | 636 } |
| OLD | NEW |