Commit f97cfa26 authored by Andrei Chulkov's avatar Andrei Chulkov Committed by Commit Bot

Hide the save password infobar when the leak detection dialog is shown

This CL makes the password manager hide the save password infobar
before showing any of the leak detection dialogs. The update password
infobar is not affected by this.

Bug: 1001052
Change-Id: Ic07e5fb9eb5ae081e2bc3c02de4df8971cbd105b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1782900Reviewed-by: default avatarIoana Pandele <ioanap@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693790}
parent dd1fbeb3
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
#include "chrome/browser/android/preferences/preferences_launcher.h" #include "chrome/browser/android/preferences/preferences_launcher.h"
#include "chrome/browser/android/tab_android.h" #include "chrome/browser/android/tab_android.h"
#include "chrome/browser/autofill/manual_filling_controller.h" #include "chrome/browser/autofill/manual_filling_controller.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/password_manager/account_chooser_dialog_android.h" #include "chrome/browser/password_manager/account_chooser_dialog_android.h"
#include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h" #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h"
#include "chrome/browser/password_manager/credential_leak_controller_android.h" #include "chrome/browser/password_manager/credential_leak_controller_android.h"
...@@ -115,6 +116,7 @@ ...@@ -115,6 +116,7 @@
#include "chrome/browser/password_manager/update_password_infobar_delegate_android.h" #include "chrome/browser/password_manager/update_password_infobar_delegate_android.h"
#include "chrome/browser/ui/android/passwords/onboarding_dialog_view.h" #include "chrome/browser/ui/android/passwords/onboarding_dialog_view.h"
#include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h"
#include "components/infobars/core/infobar.h"
#include "components/password_manager/core/browser/credential_cache.h" #include "components/password_manager/core/browser/credential_cache.h"
#include "ui/base/ui_base_features.h" #include "ui/base/ui_base_features.h"
#else #else
...@@ -160,6 +162,21 @@ void AddToWidgetInputEventObservers( ...@@ -160,6 +162,21 @@ void AddToWidgetInputEventObservers(
} }
#endif #endif
#if defined(OS_ANDROID)
void HideSavePasswordInfobar(content::WebContents* web_contents) {
InfoBarService* infobar_service =
InfoBarService::FromWebContents(web_contents);
for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
infobars::InfoBar* infobar = infobar_service->infobar_at(i);
if (infobar->delegate()->GetIdentifier() ==
SavePasswordInfoBarDelegate::SAVE_PASSWORD_INFOBAR_DELEGATE_MOBILE) {
infobar_service->RemoveInfoBar(infobar);
break;
}
}
}
#endif // defined(OS_ANDROID)
} // namespace } // namespace
// static // static
...@@ -501,6 +518,7 @@ void ChromePasswordManagerClient::NotifyUserCredentialsWereLeaked( ...@@ -501,6 +518,7 @@ void ChromePasswordManagerClient::NotifyUserCredentialsWereLeaked(
password_manager::CredentialLeakType leak_type, password_manager::CredentialLeakType leak_type,
const GURL& origin) { const GURL& origin) {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
HideSavePasswordInfobar(web_contents());
(new CredentialLeakControllerAndroid( (new CredentialLeakControllerAndroid(
leak_type, origin, web_contents()->GetTopLevelNativeWindow())) leak_type, origin, web_contents()->GetTopLevelNativeWindow()))
->ShowDialog(); ->ShowDialog();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment