Commit a42ef11e authored by edchin's avatar edchin Committed by Commit Bot

[ios][PhishGuard] Enable Gaia and enterprise hash behind flag

Design doc: go/bling-phishguard

This CL continues work to compile code in iOS that was previously
disabled behind PASSWORD_REUSE_DETECTION_ENABLED.

Runtime changes are put behind a new feature flag.

Bug: 1147962
Change-Id: I102c7c34630e7d3e848f2077b2703d223e4a788c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536936Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: default avatarAli Juma <ajuma@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827270}
parent 58398d43
......@@ -7,6 +7,8 @@
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "components/password_manager/core/browser/password_form.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/sync/base/user_selectable_type.h"
#include "components/sync/driver/sync_user_settings.h"
......@@ -14,10 +16,6 @@
#include "google_apis/gaia/gaia_urls.h"
#include "url/origin.h"
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#endif // PASSWORD_REUSE_DETECTION_ENABLED
using url::Origin;
namespace {
......@@ -87,13 +85,12 @@ bool IsGaiaCredentialPage(const std::string& signon_realm) {
bool ShouldSaveEnterprisePasswordHash(const PasswordForm& form,
const PrefService& prefs) {
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
if (base::FeatureList::IsEnabled(features::kPasswordReuseDetectionEnabled)) {
return safe_browsing::MatchesPasswordProtectionLoginURL(form.url, prefs) ||
safe_browsing::MatchesPasswordProtectionChangePasswordURL(form.url,
prefs);
#else
}
return false;
#endif // PASSWORD_REUSE_DETECTION_ENABLED
}
} // namespace sync_util
......
......@@ -68,12 +68,11 @@ bool SyncCredentialsFilter::ShouldSave(const PasswordForm& form) const {
bool SyncCredentialsFilter::ShouldSaveGaiaPasswordHash(
const PasswordForm& form) const {
#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
if (base::FeatureList::IsEnabled(features::kPasswordReuseDetectionEnabled)) {
return !client_->IsIncognito() &&
sync_util::IsGaiaCredentialPage(form.signon_realm);
#else
}
return false;
#endif // PASSWORD_REUSE_DETECTION_ENABLED
}
bool SyncCredentialsFilter::ShouldSaveEnterprisePasswordHash(
......
......@@ -71,6 +71,16 @@ const base::Feature kPasswordCheck = {"PasswordCheck",
const base::Feature kPasswordImport = {"PasswordImport",
base::FEATURE_DISABLED_BY_DEFAULT};
// Enables password reuse detection.
const base::Feature kPasswordReuseDetectionEnabled = {
"PasswordReuseDetectionEnabled",
#if defined(OS_IOS)
base::FEATURE_DISABLED_BY_DEFAULT
#else
base::FEATURE_ENABLED_BY_DEFAULT
#endif // defined(OS_IOS)
};
// Enables password scripts fetching for the |PasswordChangeInSettings| feature.
const base::Feature kPasswordScriptsFetching = {
"PasswordScriptsFetching", base::FEATURE_DISABLED_BY_DEFAULT};
......
......@@ -30,6 +30,7 @@ extern const base::Feature kPasswordChange;
extern const base::Feature kPasswordChangeInSettings;
extern const base::Feature kPasswordCheck;
extern const base::Feature kPasswordImport;
extern const base::Feature kPasswordReuseDetectionEnabled;
extern const base::Feature kPasswordScriptsFetching;
extern const base::Feature kPasswordsWeaknessCheck;
extern const base::Feature kRecoverFromNeverSaveAndroid;
......
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