Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(699)

Unified Diff: components/safe_browsing/password_protection/password_protection_service.cc

Issue 2856033002: Add finch control of user population in low reputation requests (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/safe_browsing/password_protection/password_protection_service.cc
diff --git a/components/safe_browsing/password_protection/password_protection_service.cc b/components/safe_browsing/password_protection/password_protection_service.cc
index b50244e201752fc18818f0c89d05f08b03f44375..32038372bb4d03e780fd3566b616531391888bc7 100644
--- a/components/safe_browsing/password_protection/password_protection_service.cc
+++ b/components/safe_browsing/password_protection/password_protection_service.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/memory/ptr_util.h"
+#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
@@ -63,6 +64,12 @@ GURL GetHostNameWithHTTPScheme(const GURL& url) {
} // namespace
+const base::Feature kLowReputationPinging{"LowReputationPinging",
+ base::FEATURE_DISABLED_BY_DEFAULT};
+
+const base::Feature kProtectedPasswordEntryPinging{
+ "ProtectedPasswordEntryPinging", base::FEATURE_DISABLED_BY_DEFAULT};
+
PasswordProtectionService::PasswordProtectionService(
const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager,
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
@@ -214,7 +221,7 @@ void PasswordProtectionService::MaybeStartLowReputationRequest(
const GURL& password_form_action,
const GURL& password_form_frame_url) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (!IsPingingEnabled())
+ if (!IsPingingEnabled(kLowReputationPinging))
return;
// Skip URLs that we can't get a reliable reputation for.
@@ -300,6 +307,31 @@ int PasswordProtectionService::GetRequestTimeoutInMS() {
return kRequestTimeoutMs;
}
+void PasswordProtectionService::FillUserPopulation(
+ const LoginReputationClientRequest::TriggerType& request_type,
+ LoginReputationClientRequest* request_proto) {
+ ChromeUserPopulation* user_population = request_proto->mutable_population();
+ user_population->set_user_population(
+ IsExtendedReporting() ? ChromeUserPopulation::EXTENDED_REPORTING
+ : ChromeUserPopulation::SAFE_BROWSING);
+ user_population->set_is_history_sync_enabled(IsHistorySyncEnabled());
+
+ base::FieldTrial* low_reputation_field_trial =
+ base::FeatureList::GetFieldTrial(kLowReputationPinging);
+ if (low_reputation_field_trial) {
+ user_population->add_finch_active_groups(
+ low_reputation_field_trial->trial_name() + "|" +
+ low_reputation_field_trial->group_name());
+ }
+ base::FieldTrial* password_entry_field_trial =
+ base::FeatureList::GetFieldTrial(kProtectedPasswordEntryPinging);
+ if (password_entry_field_trial) {
+ user_population->add_finch_active_groups(
+ low_reputation_field_trial->trial_name() + "|" +
+ low_reputation_field_trial->group_name());
+ }
+}
+
void PasswordProtectionService::OnMatchCsdWhiteListResult(
const bool* match_whitelist) {
UMA_HISTOGRAM_BOOLEAN(

Powered by Google App Engine
This is Rietveld 408576698