| Index: chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
|
| diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
|
| index 224f36da1e303ee5f5124f39a706945f972386f0..94819a3f7fe5217111af98f6978862ba72eb6eb5 100644
|
| --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
|
| +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
|
| @@ -27,8 +27,10 @@
|
|
|
| #if defined(OS_ANDROID)
|
| #include "chrome/browser/android/chrome_application.h"
|
| +#include "chrome/browser/android/tab_android.h"
|
| #include "chrome/browser/infobars/infobar_service.h"
|
| #include "chrome/browser/password_manager/account_chooser_infobar_delegate_android.h"
|
| +#include "chrome/browser/ui/android/snackbars/auto_signin_snackbar_controller.h"
|
| #endif
|
|
|
| using autofill::PasswordFormMap;
|
| @@ -91,6 +93,25 @@ void ManagePasswordsUIController::
|
| #endif
|
| }
|
|
|
| +void ManagePasswordsUIController::UpdateAutoSigninSnackbarVisibility() {
|
| +#if defined(OS_ANDROID)
|
| + base::android::ScopedJavaLocalRef<jobject> credential;
|
| + const autofill::PasswordForm *password_form = nullptr;
|
| + if (GetFederatedForms().size() == 1) {
|
| + password_form = GetFederatedForms()[0];
|
| + } else if (GetCurrentForms().size() == 1) {
|
| + password_form = GetCurrentForms()[0];
|
| + }
|
| + if (password_form) {
|
| + // Deletes itself after snackbar was dismissed.
|
| + AutoSigninSnackbarController* controller = new AutoSigninSnackbarController(
|
| + TabAndroid::FromWebContents(web_contents()));
|
| + controller->onShow(password_form->username_value);
|
| + }
|
| + should_pop_up_bubble_ = false;
|
| +#endif
|
| +}
|
| +
|
| base::TimeDelta ManagePasswordsUIController::Elapsed() const {
|
| return timer_ ? timer_->Elapsed() : base::TimeDelta::Max();
|
| }
|
| @@ -141,7 +162,11 @@ void ManagePasswordsUIController::OnAutoSignin(
|
| passwords_data_.OnAutoSignin(local_forms.Pass());
|
| timer_.reset(new base::ElapsedTimer);
|
| base::AutoReset<bool> resetter(&should_pop_up_bubble_, true);
|
| +#if defined(OS_ANDROID)
|
| + UpdateAutoSigninSnackbarVisibility();
|
| +#else
|
| UpdateBubbleAndIconVisibility();
|
| +#endif
|
| }
|
|
|
| void ManagePasswordsUIController::OnAutomaticPasswordSave(
|
|
|