Commit ea1fe589 authored by Maxim Kolosovskiy's avatar Maxim Kolosovskiy Committed by Commit Bot

[Autofill Assistant] Make |was_leak_dialog_shown_| available on Android

http://crrev/750176 introduced |was_lead_warning_shown_| to track
whether a credentials leak dialog was shown. The flag was introduced
behind the compilation flag ENABLE_PASSWORD_CHANGE.

Now we need |was_leak_warning_shown_| even if |ENABLE_PASSWORD_CHANGE|
is not defined because the flag will be used by a Java integration test,
which is independent of |ENABLE_PASSWORD_CHANGE|.

This CL also renames |was_leak_warning_shown_| to
|was_leak_dialog_shown_| as it is more consistent with the method name
|WasCredentialLeakDialogShown|.

Bug: 1057608
Change-Id: Ie0cce7dfd37f967bcd2013b441c0783dbe269c5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2109704
Commit-Queue: Maxim Kolosovskiy <kolos@chromium.org>
Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Auto-Submit: Maxim Kolosovskiy <kolos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752022}
parent 84acfdbb
...@@ -554,7 +554,7 @@ void ChromePasswordManagerClient::NotifyUserCredentialsWereLeaked( ...@@ -554,7 +554,7 @@ void ChromePasswordManagerClient::NotifyUserCredentialsWereLeaked(
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
HideSavePasswordInfobar(web_contents()); HideSavePasswordInfobar(web_contents());
#if defined(ENABLE_PASSWORD_CHANGE) #if defined(ENABLE_PASSWORD_CHANGE)
was_leak_warning_shown_ = true; was_leak_dialog_shown_ = true;
(new CredentialLeakPasswordChangeControllerAndroid( (new CredentialLeakPasswordChangeControllerAndroid(
leak_type, origin, username, web_contents()->GetTopLevelNativeWindow())) leak_type, origin, username, web_contents()->GetTopLevelNativeWindow()))
->ShowDialog(); ->ShowDialog();
...@@ -682,6 +682,10 @@ ChromePasswordManagerClient::GetOrCreateTouchToFillController() { ...@@ -682,6 +682,10 @@ ChromePasswordManagerClient::GetOrCreateTouchToFillController() {
return touch_to_fill_controller_.get(); return touch_to_fill_controller_.get();
} }
bool ChromePasswordManagerClient::WasCredentialLeakDialogShown() const {
return was_leak_dialog_shown_;
}
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
void ChromePasswordManagerClient::DidFinishNavigation( void ChromePasswordManagerClient::DidFinishNavigation(
...@@ -834,15 +838,6 @@ bool ChromePasswordManagerClient::WasLastNavigationHTTPError() const { ...@@ -834,15 +838,6 @@ bool ChromePasswordManagerClient::WasLastNavigationHTTPError() const {
return false; return false;
} }
bool ChromePasswordManagerClient::WasCredentialLeakDialogShown() const {
#if defined(ENABLE_PASSWORD_CHANGE)
return was_leak_warning_shown_;
#else
// Don't allow a password change flow if the feature is not enabled.
return false;
#endif
}
net::CertStatus ChromePasswordManagerClient::GetMainFrameCertStatus() const { net::CertStatus ChromePasswordManagerClient::GetMainFrameCertStatus() const {
content::NavigationEntry* entry = content::NavigationEntry* entry =
web_contents()->GetController().GetLastCommittedEntry(); web_contents()->GetController().GetLastCommittedEntry();
......
...@@ -143,7 +143,6 @@ class ChromePasswordManagerClient ...@@ -143,7 +143,6 @@ class ChromePasswordManagerClient
password_manager::PasswordStore* GetAccountPasswordStore() const override; password_manager::PasswordStore* GetAccountPasswordStore() const override;
password_manager::SyncState GetPasswordSyncState() const override; password_manager::SyncState GetPasswordSyncState() const override;
bool WasLastNavigationHTTPError() const override; bool WasLastNavigationHTTPError() const override;
bool WasCredentialLeakDialogShown() const override;
net::CertStatus GetMainFrameCertStatus() const override; net::CertStatus GetMainFrameCertStatus() const override;
void PromptUserToEnableAutosignin() override; void PromptUserToEnableAutosignin() override;
bool IsIncognito() const override; bool IsIncognito() const override;
...@@ -253,6 +252,11 @@ class ChromePasswordManagerClient ...@@ -253,6 +252,11 @@ class ChromePasswordManagerClient
password_manager::CredentialCache* GetCredentialCacheForTesting() { password_manager::CredentialCache* GetCredentialCacheForTesting() {
return &credential_cache_; return &credential_cache_;
} }
bool WasCredentialLeakDialogShown() const override;
void SetCredentialLeakDialogWasShownForTesting() {
was_leak_dialog_shown_ = true;
}
#endif #endif
protected: protected:
...@@ -332,6 +336,10 @@ class ChromePasswordManagerClient ...@@ -332,6 +336,10 @@ class ChromePasswordManagerClient
// event is triggered. It is sent to password reuse detection manager and // event is triggered. It is sent to password reuse detection manager and
// reset when ime finish composing text event is triggered. // reset when ime finish composing text event is triggered.
base::string16 last_composing_text_; base::string16 last_composing_text_;
// Whether a leak warning was shown. Used only for tests or when
// ENABLE_PASSWORD_CHANGE is defined.
bool was_leak_dialog_shown_ = false;
#endif #endif
std::unique_ptr<ChromeBiometricAuthenticator> biometric_authenticator_; std::unique_ptr<ChromeBiometricAuthenticator> biometric_authenticator_;
...@@ -374,11 +382,6 @@ class ChromePasswordManagerClient ...@@ -374,11 +382,6 @@ class ChromePasswordManagerClient
// Whether OnPaste() was called from this ChromePasswordManagerClient // Whether OnPaste() was called from this ChromePasswordManagerClient
bool was_on_paste_called_ = false; bool was_on_paste_called_ = false;
#if defined(ENABLE_PASSWORD_CHANGE)
// Whether a leak warning was shown.
bool was_leak_warning_shown_ = false;
#endif
// Helper for performing logic that is common between // Helper for performing logic that is common between
// ChromePasswordManagerClient and IOSChromePasswordManagerClient. // ChromePasswordManagerClient and IOSChromePasswordManagerClient.
password_manager::PasswordManagerClientHelper helper_; password_manager::PasswordManagerClientHelper helper_;
......
...@@ -73,9 +73,11 @@ bool PasswordManagerClient::WasLastNavigationHTTPError() const { ...@@ -73,9 +73,11 @@ bool PasswordManagerClient::WasLastNavigationHTTPError() const {
return false; return false;
} }
#if defined(OS_ANDROID)
bool PasswordManagerClient::WasCredentialLeakDialogShown() const { bool PasswordManagerClient::WasCredentialLeakDialogShown() const {
return false; return false;
} }
#endif
net::CertStatus PasswordManagerClient::GetMainFrameCertStatus() const { net::CertStatus PasswordManagerClient::GetMainFrameCertStatus() const {
return 0; return 0;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "base/util/type_safety/strong_alias.h" #include "base/util/type_safety/strong_alias.h"
#include "build/build_config.h"
#include "components/autofill/core/common/mojom/autofill_types.mojom.h" #include "components/autofill/core/common/mojom/autofill_types.mojom.h"
#include "components/autofill/core/common/password_form.h" #include "components/autofill/core/common/password_form.h"
#include "components/password_manager/core/browser/credentials_filter.h" #include "components/password_manager/core/browser/credentials_filter.h"
...@@ -257,10 +258,12 @@ class PasswordManagerClient { ...@@ -257,10 +258,12 @@ class PasswordManagerClient {
// Returns true if last navigation page had HTTP error i.e 5XX or 4XX // Returns true if last navigation page had HTTP error i.e 5XX or 4XX
virtual bool WasLastNavigationHTTPError() const; virtual bool WasLastNavigationHTTPError() const;
#if defined(OS_ANDROID)
// Returns true if a credential leak dialog was shown. Used by Autofill // Returns true if a credential leak dialog was shown. Used by Autofill
// Assistance to verify a password change intent. TODO(b/151391231): Remove // Assistance to verify a password change intent. TODO(b/151391231): Remove
// when proper intent signing is implemented. // when proper intent signing is implemented.
virtual bool WasCredentialLeakDialogShown() const; virtual bool WasCredentialLeakDialogShown() const;
#endif
// Obtains the cert status for the main frame. // Obtains the cert status for the main frame.
virtual net::CertStatus GetMainFrameCertStatus() const; virtual net::CertStatus GetMainFrameCertStatus() const;
......
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