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

Side by Side Diff: components/safe_browsing/password_protection/password_protection_service.cc

Issue 2872993003: Rename LowReputationPinging Feature to PasswordFieldOnFocusPinging (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/safe_browsing/password_protection/password_protection_servi ce.h" 5 #include "components/safe_browsing/password_protection/password_protection_servi ce.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // e.g., "https://www.foo.com:80/bar/test.cgi" -> "http://www.foo.com". 57 // e.g., "https://www.foo.com:80/bar/test.cgi" -> "http://www.foo.com".
58 GURL GetHostNameWithHTTPScheme(const GURL& url) { 58 GURL GetHostNameWithHTTPScheme(const GURL& url) {
59 DCHECK(url.SchemeIsHTTPOrHTTPS()); 59 DCHECK(url.SchemeIsHTTPOrHTTPS());
60 std::string result(url::kHttpScheme); 60 std::string result(url::kHttpScheme);
61 result.append(url::kStandardSchemeSeparator).append(url.HostNoBrackets()); 61 result.append(url::kStandardSchemeSeparator).append(url.HostNoBrackets());
62 return GURL(result); 62 return GURL(result);
63 } 63 }
64 64
65 } // namespace 65 } // namespace
66 66
67 const base::Feature kLowReputationPinging{"LowReputationPinging", 67 const base::Feature kPasswordFieldOnFocusPinging{
68 base::FEATURE_DISABLED_BY_DEFAULT}; 68 "PasswordFieldOnFocusPinging", base::FEATURE_DISABLED_BY_DEFAULT};
69 69
70 const base::Feature kProtectedPasswordEntryPinging{ 70 const base::Feature kProtectedPasswordEntryPinging{
71 "ProtectedPasswordEntryPinging", base::FEATURE_DISABLED_BY_DEFAULT}; 71 "ProtectedPasswordEntryPinging", base::FEATURE_DISABLED_BY_DEFAULT};
72 72
73 PasswordProtectionService::PasswordProtectionService( 73 PasswordProtectionService::PasswordProtectionService(
74 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager, 74 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager,
75 scoped_refptr<net::URLRequestContextGetter> request_context_getter, 75 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
76 HistoryService* history_service, 76 HistoryService* history_service,
77 HostContentSettingsMap* host_content_settings_map) 77 HostContentSettingsMap* host_content_settings_map)
78 : stored_verdict_count_(-1), 78 : stored_verdict_count_(-1),
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 DCHECK(request); 214 DCHECK(request);
215 request->Start(); 215 request->Start();
216 requests_.insert(std::move(request)); 216 requests_.insert(std::move(request));
217 } 217 }
218 218
219 void PasswordProtectionService::MaybeStartLowReputationRequest( 219 void PasswordProtectionService::MaybeStartLowReputationRequest(
220 const GURL& main_frame_url, 220 const GURL& main_frame_url,
221 const GURL& password_form_action, 221 const GURL& password_form_action,
222 const GURL& password_form_frame_url) { 222 const GURL& password_form_frame_url) {
223 DCHECK_CURRENTLY_ON(BrowserThread::UI); 223 DCHECK_CURRENTLY_ON(BrowserThread::UI);
224 if (!IsPingingEnabled(kLowReputationPinging)) 224 if (!IsPingingEnabled(kPasswordFieldOnFocusPinging))
225 return; 225 return;
226 226
227 // Skip URLs that we can't get a reliable reputation for. 227 // Skip URLs that we can't get a reliable reputation for.
228 if (!main_frame_url.is_valid() || !main_frame_url.SchemeIsHTTPOrHTTPS()) { 228 if (!main_frame_url.is_valid() || !main_frame_url.SchemeIsHTTPOrHTTPS()) {
229 return; 229 return;
230 } 230 }
231 231
232 StartRequest(main_frame_url, password_form_action, password_form_frame_url, 232 StartRequest(main_frame_url, password_form_action, password_form_frame_url,
233 LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE); 233 LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE);
234 } 234 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 void PasswordProtectionService::FillUserPopulation( 310 void PasswordProtectionService::FillUserPopulation(
311 const LoginReputationClientRequest::TriggerType& request_type, 311 const LoginReputationClientRequest::TriggerType& request_type,
312 LoginReputationClientRequest* request_proto) { 312 LoginReputationClientRequest* request_proto) {
313 ChromeUserPopulation* user_population = request_proto->mutable_population(); 313 ChromeUserPopulation* user_population = request_proto->mutable_population();
314 user_population->set_user_population( 314 user_population->set_user_population(
315 IsExtendedReporting() ? ChromeUserPopulation::EXTENDED_REPORTING 315 IsExtendedReporting() ? ChromeUserPopulation::EXTENDED_REPORTING
316 : ChromeUserPopulation::SAFE_BROWSING); 316 : ChromeUserPopulation::SAFE_BROWSING);
317 user_population->set_is_history_sync_enabled(IsHistorySyncEnabled()); 317 user_population->set_is_history_sync_enabled(IsHistorySyncEnabled());
318 318
319 base::FieldTrial* low_reputation_field_trial = 319 base::FieldTrial* low_reputation_field_trial =
320 base::FeatureList::GetFieldTrial(kLowReputationPinging); 320 base::FeatureList::GetFieldTrial(kPasswordFieldOnFocusPinging);
321 if (low_reputation_field_trial) { 321 if (low_reputation_field_trial) {
322 user_population->add_finch_active_groups( 322 user_population->add_finch_active_groups(
323 low_reputation_field_trial->trial_name() + "|" + 323 low_reputation_field_trial->trial_name() + "|" +
324 low_reputation_field_trial->group_name()); 324 low_reputation_field_trial->group_name());
325 } 325 }
326 base::FieldTrial* password_entry_field_trial = 326 base::FieldTrial* password_entry_field_trial =
327 base::FeatureList::GetFieldTrial(kProtectedPasswordEntryPinging); 327 base::FeatureList::GetFieldTrial(kProtectedPasswordEntryPinging);
328 if (password_entry_field_trial) { 328 if (password_entry_field_trial) {
329 user_population->add_finch_active_groups( 329 user_population->add_finch_active_groups(
330 low_reputation_field_trial->trial_name() + "|" + 330 low_reputation_field_trial->trial_name() + "|" +
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 const std::vector<char> verdict_blob(serialized_proto.begin(), 478 const std::vector<char> verdict_blob(serialized_proto.begin(),
479 serialized_proto.end()); 479 serialized_proto.end());
480 std::unique_ptr<base::Value> binary_value = 480 std::unique_ptr<base::Value> binary_value =
481 base::MakeUnique<base::Value>(verdict_blob); 481 base::MakeUnique<base::Value>(verdict_blob);
482 DCHECK_EQ(base::Value::Type::BINARY, binary_value->type()); 482 DCHECK_EQ(base::Value::Type::BINARY, binary_value->type());
483 result->Set(kVerdictProto, std::move(binary_value)); 483 result->Set(kVerdictProto, std::move(binary_value));
484 return result; 484 return result;
485 } 485 }
486 486
487 } // namespace safe_browsing 487 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698