Commit 10e9b043 authored by edchin's avatar edchin Committed by Commit Bot

[ios][PhishGuard] Remove iOS-specific flag from //chrome

Design doc: go/bling-phishguard

PASSWORD_REUSE_DETECTION_ENABLED is only defined for !is_ios.
This CL removes the use of this flag in files that are already
not compiled in iOS.

Bug: 1147962
Change-Id: Ibf646ea2536ceb15de4dd5e15c140bbbe2b5269a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2543803Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828368}
parent c0688ebb
...@@ -794,13 +794,11 @@ autofill::LanguageCode ChromePasswordManagerClient::GetPageLanguage() const { ...@@ -794,13 +794,11 @@ autofill::LanguageCode ChromePasswordManagerClient::GetPageLanguage() const {
return autofill::LanguageCode(); return autofill::LanguageCode();
} }
#if defined(ON_FOCUS_PING_ENABLED) || defined(PASSWORD_REUSE_DETECTION_ENABLED)
safe_browsing::PasswordProtectionService* safe_browsing::PasswordProtectionService*
ChromePasswordManagerClient::GetPasswordProtectionService() const { ChromePasswordManagerClient::GetPasswordProtectionService() const {
return safe_browsing::ChromePasswordProtectionService:: return safe_browsing::ChromePasswordProtectionService::
GetPasswordProtectionService(profile_); GetPasswordProtectionService(profile_);
} }
#endif
#if defined(ON_FOCUS_PING_ENABLED) #if defined(ON_FOCUS_PING_ENABLED)
void ChromePasswordManagerClient::CheckSafeBrowsingReputation( void ChromePasswordManagerClient::CheckSafeBrowsingReputation(
...@@ -816,7 +814,6 @@ void ChromePasswordManagerClient::CheckSafeBrowsingReputation( ...@@ -816,7 +814,6 @@ void ChromePasswordManagerClient::CheckSafeBrowsingReputation(
} }
#endif // defined(ON_FOCUS_PING_ENABLED) #endif // defined(ON_FOCUS_PING_ENABLED)
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
void ChromePasswordManagerClient::CheckProtectedPasswordEntry( void ChromePasswordManagerClient::CheckProtectedPasswordEntry(
PasswordType password_type, PasswordType password_type,
const std::string& username, const std::string& username,
...@@ -832,7 +829,6 @@ void ChromePasswordManagerClient::CheckProtectedPasswordEntry( ...@@ -832,7 +829,6 @@ void ChromePasswordManagerClient::CheckProtectedPasswordEntry(
web_contents(), web_contents()->GetLastCommittedURL(), username, web_contents(), web_contents()->GetLastCommittedURL(), username,
password_type, matching_reused_credentials, password_field_exists); password_type, matching_reused_credentials, password_field_exists);
} }
#endif // defined(PASSWORD_REUSE_DETECTION_ENABLED)
#if defined(PASSWORD_REUSE_WARNING_ENABLED) #if defined(PASSWORD_REUSE_WARNING_ENABLED)
void ChromePasswordManagerClient::LogPasswordReuseDetectedEvent() { void ChromePasswordManagerClient::LogPasswordReuseDetectedEvent() {
...@@ -1062,25 +1058,19 @@ void ChromePasswordManagerClient::GenerationElementLostFocus() { ...@@ -1062,25 +1058,19 @@ void ChromePasswordManagerClient::GenerationElementLostFocus() {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
void ChromePasswordManagerClient::OnImeTextCommittedEvent( void ChromePasswordManagerClient::OnImeTextCommittedEvent(
const base::string16& text_str) { const base::string16& text_str) {
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
password_reuse_detection_manager_.OnKeyPressedCommitted(text_str); password_reuse_detection_manager_.OnKeyPressedCommitted(text_str);
#endif // defined(PASSWORD_REUSE_DETECTION_ENABLED)
} }
void ChromePasswordManagerClient::OnImeSetComposingTextEvent( void ChromePasswordManagerClient::OnImeSetComposingTextEvent(
const base::string16& text_str) { const base::string16& text_str) {
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
last_composing_text_ = text_str; last_composing_text_ = text_str;
password_reuse_detection_manager_.OnKeyPressedUncommitted( password_reuse_detection_manager_.OnKeyPressedUncommitted(
last_composing_text_); last_composing_text_);
#endif // defined(PASSWORD_REUSE_DETECTION_ENABLED)
} }
void ChromePasswordManagerClient::OnImeFinishComposingTextEvent() { void ChromePasswordManagerClient::OnImeFinishComposingTextEvent() {
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
password_reuse_detection_manager_.OnKeyPressedCommitted(last_composing_text_); password_reuse_detection_manager_.OnKeyPressedCommitted(last_composing_text_);
last_composing_text_.clear(); last_composing_text_.clear();
#endif // defined(PASSWORD_REUSE_DETECTION_ENABLED)
} }
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
...@@ -1167,9 +1157,7 @@ ChromePasswordManagerClient::ChromePasswordManagerClient( ...@@ -1167,9 +1157,7 @@ ChromePasswordManagerClient::ChromePasswordManagerClient(
profile_->GetPrefs(), profile_->GetPrefs(),
ProfileSyncServiceFactory::GetForProfile(profile_)), ProfileSyncServiceFactory::GetForProfile(profile_)),
httpauth_manager_(this), httpauth_manager_(this),
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
password_reuse_detection_manager_(this), password_reuse_detection_manager_(this),
#endif
driver_factory_(nullptr), driver_factory_(nullptr),
content_credential_manager_(this), content_credential_manager_(this),
password_generation_driver_receivers_(web_contents, this), password_generation_driver_receivers_(web_contents, this),
...@@ -1242,9 +1230,7 @@ void ChromePasswordManagerClient::DidFinishNavigation( ...@@ -1242,9 +1230,7 @@ void ChromePasswordManagerClient::DidFinishNavigation(
// requests. // requests.
content_credential_manager_.DisconnectBinding(); content_credential_manager_.DisconnectBinding();
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
password_reuse_detection_manager_.DidNavigateMainFrame(GetLastCommittedURL()); password_reuse_detection_manager_.DidNavigateMainFrame(GetLastCommittedURL());
#endif // defined(PASSWORD_REUSE_DETECTION_ENABLED)
#if !BUILDFLAG(GOOGLE_CHROME_BRANDING) #if !BUILDFLAG(GOOGLE_CHROME_BRANDING)
// TODO(https://crbug.com/1104919): Remove this logging. // TODO(https://crbug.com/1104919): Remove this logging.
...@@ -1353,7 +1339,6 @@ void ChromePasswordManagerClient::OnInputEvent( ...@@ -1353,7 +1339,6 @@ void ChromePasswordManagerClient::OnInputEvent(
const blink::WebInputEvent& event) { const blink::WebInputEvent& event) {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
// On Android, key down events are triggered if a user types in through a // On Android, key down events are triggered if a user types in through a
// number bar on Android keyboard. If text is typed in through other parts of // number bar on Android keyboard. If text is typed in through other parts of
// Android keyboard, ImeTextCommittedEvent is triggered instead. // Android keyboard, ImeTextCommittedEvent is triggered instead.
...@@ -1362,7 +1347,6 @@ void ChromePasswordManagerClient::OnInputEvent( ...@@ -1362,7 +1347,6 @@ void ChromePasswordManagerClient::OnInputEvent(
const blink::WebKeyboardEvent& key_event = const blink::WebKeyboardEvent& key_event =
static_cast<const blink::WebKeyboardEvent&>(event); static_cast<const blink::WebKeyboardEvent&>(event);
password_reuse_detection_manager_.OnKeyPressedCommitted(key_event.text); password_reuse_detection_manager_.OnKeyPressedCommitted(key_event.text);
#endif // defined(PASSWORD_REUSE_DETECTION_ENABLED)
#else // !defined(OS_ANDROID) #else // !defined(OS_ANDROID)
if (event.GetType() != blink::WebInputEvent::Type::kChar) if (event.GetType() != blink::WebInputEvent::Type::kChar)
......
...@@ -186,24 +186,20 @@ class ChromePasswordManagerClient ...@@ -186,24 +186,20 @@ class ChromePasswordManagerClient
void AnnotateNavigationEntry(bool has_password_field) override; void AnnotateNavigationEntry(bool has_password_field) override;
autofill::LanguageCode GetPageLanguage() const override; autofill::LanguageCode GetPageLanguage() const override;
#if defined(ON_FOCUS_PING_ENABLED) || defined(PASSWORD_REUSE_DETECTION_ENABLED)
safe_browsing::PasswordProtectionService* GetPasswordProtectionService() safe_browsing::PasswordProtectionService* GetPasswordProtectionService()
const override; const override;
#endif
#if defined(ON_FOCUS_PING_ENABLED) #if defined(ON_FOCUS_PING_ENABLED)
void CheckSafeBrowsingReputation(const GURL& form_action, void CheckSafeBrowsingReputation(const GURL& form_action,
const GURL& frame_url) override; const GURL& frame_url) override;
#endif #endif
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
void CheckProtectedPasswordEntry( void CheckProtectedPasswordEntry(
password_manager::metrics_util::PasswordType reused_password_type, password_manager::metrics_util::PasswordType reused_password_type,
const std::string& username, const std::string& username,
const std::vector<password_manager::MatchingReusedCredential>& const std::vector<password_manager::MatchingReusedCredential>&
matching_reused_credentials, matching_reused_credentials,
bool password_field_exists) override; bool password_field_exists) override;
#endif
#if defined(PASSWORD_REUSE_WARNING_ENABLED) #if defined(PASSWORD_REUSE_WARNING_ENABLED)
void LogPasswordReuseDetectedEvent() override; void LogPasswordReuseDetectedEvent() override;
...@@ -345,11 +341,8 @@ class ChromePasswordManagerClient ...@@ -345,11 +341,8 @@ class ChromePasswordManagerClient
password_manager::PasswordManager password_manager_; password_manager::PasswordManager password_manager_;
password_manager::PasswordFeatureManagerImpl password_feature_manager_; password_manager::PasswordFeatureManagerImpl password_feature_manager_;
password_manager::HttpAuthManagerImpl httpauth_manager_; password_manager::HttpAuthManagerImpl httpauth_manager_;
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
password_manager::PasswordReuseDetectionManager password_manager::PasswordReuseDetectionManager
password_reuse_detection_manager_; password_reuse_detection_manager_;
#endif
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// Holds and facilitates a credential store for each origin in this tab. // Holds and facilitates a credential store for each origin in this tab.
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/password_manager/credentials_cleaner_runner_factory.h" #include "chrome/browser/password_manager/credentials_cleaner_runner_factory.h"
#include "chrome/browser/password_manager/password_store_signin_notifier_impl.h"
#include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
...@@ -39,24 +40,17 @@ ...@@ -39,24 +40,17 @@
#include "chrome/browser/password_manager/password_manager_util_win.h" #include "chrome/browser/password_manager/password_manager_util_win.h"
#endif #endif
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
#include "chrome/browser/password_manager/password_store_signin_notifier_impl.h"
#endif
using password_manager::PasswordStore; using password_manager::PasswordStore;
namespace { namespace {
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
std::string GetSyncUsername(Profile* profile) { std::string GetSyncUsername(Profile* profile) {
auto* identity_manager = auto* identity_manager =
IdentityManagerFactory::GetForProfileIfExists(profile); IdentityManagerFactory::GetForProfileIfExists(profile);
return identity_manager ? identity_manager->GetPrimaryAccountInfo().email return identity_manager ? identity_manager->GetPrimaryAccountInfo().email
: std::string(); : std::string();
} }
#endif
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
bool IsSignedIn(Profile* profile) { bool IsSignedIn(Profile* profile) {
auto* identity_manager = auto* identity_manager =
IdentityManagerFactory::GetForProfileIfExists(profile); IdentityManagerFactory::GetForProfileIfExists(profile);
...@@ -64,7 +58,6 @@ bool IsSignedIn(Profile* profile) { ...@@ -64,7 +58,6 @@ bool IsSignedIn(Profile* profile) {
? !identity_manager->GetAccountsWithRefreshTokens().empty() ? !identity_manager->GetAccountsWithRefreshTokens().empty()
: false; : false;
} }
#endif
} // namespace } // namespace
...@@ -109,11 +102,9 @@ PasswordStoreFactory::PasswordStoreFactory() ...@@ -109,11 +102,9 @@ PasswordStoreFactory::PasswordStoreFactory()
"PasswordStore", "PasswordStore",
BrowserContextDependencyManager::GetInstance()) { BrowserContextDependencyManager::GetInstance()) {
DependsOn(WebDataServiceFactory::GetInstance()); DependsOn(WebDataServiceFactory::GetInstance());
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
// TODO(crbug.com/715987). Remove when PasswordReuseDetector is decoupled // TODO(crbug.com/715987). Remove when PasswordReuseDetector is decoupled
// from PasswordStore. // from PasswordStore.
DependsOn(IdentityManagerFactory::GetInstance()); DependsOn(IdentityManagerFactory::GetInstance());
#endif
} }
PasswordStoreFactory::~PasswordStoreFactory() = default; PasswordStoreFactory::~PasswordStoreFactory() = default;
...@@ -152,10 +143,8 @@ PasswordStoreFactory::BuildServiceInstanceFor( ...@@ -152,10 +143,8 @@ PasswordStoreFactory::BuildServiceInstanceFor(
return nullptr; return nullptr;
} }
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
// Prepare password hash data for reuse detection. // Prepare password hash data for reuse detection.
ps->PreparePasswordHashData(GetSyncUsername(profile), IsSignedIn(profile)); ps->PreparePasswordHashData(GetSyncUsername(profile), IsSignedIn(profile));
#endif
auto network_context_getter = base::BindRepeating( auto network_context_getter = base::BindRepeating(
[](Profile* profile) -> network::mojom::NetworkContext* { [](Profile* profile) -> network::mojom::NetworkContext* {
......
...@@ -472,7 +472,6 @@ class ChromePasswordProtectionService : public PasswordProtectionService { ...@@ -472,7 +472,6 @@ class ChromePasswordProtectionService : public PasswordProtectionService {
// Returns whether the profile is valid and has safe browsing service enabled. // Returns whether the profile is valid and has safe browsing service enabled.
bool IsSafeBrowsingEnabled(); bool IsSafeBrowsingEnabled();
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
void MaybeLogPasswordReuseLookupResult( void MaybeLogPasswordReuseLookupResult(
content::WebContents* web_contents, content::WebContents* web_contents,
sync_pb::GaiaPasswordReuse::PasswordReuseLookup::LookupResult result); sync_pb::GaiaPasswordReuse::PasswordReuseLookup::LookupResult result);
...@@ -546,8 +545,6 @@ class ChromePasswordProtectionService : public PasswordProtectionService { ...@@ -546,8 +545,6 @@ class ChromePasswordProtectionService : public PasswordProtectionService {
LoginReputationClientResponse::VerdictType verdict_type, LoginReputationClientResponse::VerdictType verdict_type,
const std::string& verdict_token); const std::string& verdict_token);
#endif
#if BUILDFLAG(FULL_SAFE_BROWSING) #if BUILDFLAG(FULL_SAFE_BROWSING)
// Get the content area size of current browsing window. // Get the content area size of current browsing window.
gfx::Size GetCurrentContentAreaSize() const override; gfx::Size GetCurrentContentAreaSize() const override;
......
...@@ -362,7 +362,6 @@ void InlineSigninHelper::OnClientOAuthSuccessAndBrowserOpened( ...@@ -362,7 +362,6 @@ void InlineSigninHelper::OnClientOAuthSuccessAndBrowserOpened(
LocalAuth::SetLocalAuthCredentials(profile_, password_); LocalAuth::SetLocalAuthCredentials(profile_, password_);
} }
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
if (!password_.empty()) { if (!password_.empty()) {
scoped_refptr<password_manager::PasswordStore> password_store = scoped_refptr<password_manager::PasswordStore> password_store =
PasswordStoreFactory::GetForProfile(profile_, PasswordStoreFactory::GetForProfile(profile_,
...@@ -374,7 +373,7 @@ void InlineSigninHelper::OnClientOAuthSuccessAndBrowserOpened( ...@@ -374,7 +373,7 @@ void InlineSigninHelper::OnClientOAuthSuccessAndBrowserOpened(
SAVED_ON_CHROME_SIGNIN); SAVED_ON_CHROME_SIGNIN);
} }
} }
#endif
if (reason == HandlerSigninReason::UNLOCK) { if (reason == HandlerSigninReason::UNLOCK) {
DCHECK(!identity_manager->GetPrimaryAccountInfo(signin::ConsentLevel::kSync) DCHECK(!identity_manager->GetPrimaryAccountInfo(signin::ConsentLevel::kSync)
.IsEmpty()); .IsEmpty());
......
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