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

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: replace PasswordReuse with ProtectedPasswordEntry 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 c87ed1ec206f107e074129d632e265be6a494630..df8b92c8469f9a3e6ac308988d372405502ed34e 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,25 @@ 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* field_trial = base::FeatureList::GetFieldTrial(
+ request_type == LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE
+ ? kLowReputationPinging
+ : kProtectedPasswordEntryPinging);
+ if (field_trial) {
+ user_population->set_finch_active_group(field_trial->trial_name() + "|" +
Nathan Parker 2017/05/05 20:58:22 Would it be useful to know the group name for both
Jialiu Lin 2017/05/05 22:19:32 SG. Changed to a repeated field.
+ field_trial->group_name());
+ }
+}
+
void PasswordProtectionService::OnMatchCsdWhiteListResult(
const bool* match_whitelist) {
UMA_HISTOGRAM_BOOLEAN(

Powered by Google App Engine
This is Rietveld 408576698