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