OLD | NEW |
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 } // namespace | 65 } // namespace |
66 | 66 |
67 const base::Feature kPasswordFieldOnFocusPinging{ | 67 const base::Feature kPasswordFieldOnFocusPinging{ |
68 "PasswordFieldOnFocusPinging", 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 const char kPasswordOnFocusRequestOutcomeHistogramName[] = |
| 74 "PasswordProtection.RequestOutcome.PasswordFieldOnFocus"; |
| 75 const char kPasswordEntryRequestOutcomeHistogramName[] = |
| 76 "PasswordProtection.RequestOutcome.ProtectedPasswordEntry"; |
| 77 |
73 PasswordProtectionService::PasswordProtectionService( | 78 PasswordProtectionService::PasswordProtectionService( |
74 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager, | 79 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager, |
75 scoped_refptr<net::URLRequestContextGetter> request_context_getter, | 80 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
76 HistoryService* history_service, | 81 HistoryService* history_service, |
77 HostContentSettingsMap* host_content_settings_map) | 82 HostContentSettingsMap* host_content_settings_map) |
78 : stored_verdict_count_(-1), | 83 : stored_verdict_count_(-1), |
79 database_manager_(database_manager), | 84 database_manager_(database_manager), |
80 request_context_getter_(request_context_getter), | 85 request_context_getter_(request_context_getter), |
81 history_service_observer_(this), | 86 history_service_observer_(this), |
82 content_settings_(host_content_settings_map), | 87 content_settings_(host_content_settings_map), |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 214 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
210 scoped_refptr<PasswordProtectionRequest> request( | 215 scoped_refptr<PasswordProtectionRequest> request( |
211 new PasswordProtectionRequest(main_frame_url, password_form_action, | 216 new PasswordProtectionRequest(main_frame_url, password_form_action, |
212 password_form_frame_url, type, this, | 217 password_form_frame_url, type, this, |
213 GetRequestTimeoutInMS())); | 218 GetRequestTimeoutInMS())); |
214 DCHECK(request); | 219 DCHECK(request); |
215 request->Start(); | 220 request->Start(); |
216 requests_.insert(std::move(request)); | 221 requests_.insert(std::move(request)); |
217 } | 222 } |
218 | 223 |
219 void PasswordProtectionService::MaybeStartLowReputationRequest( | 224 void PasswordProtectionService::MaybeStartPasswordFieldOnFocusRequest( |
220 const GURL& main_frame_url, | 225 const GURL& main_frame_url, |
221 const GURL& password_form_action, | 226 const GURL& password_form_action, |
222 const GURL& password_form_frame_url) { | 227 const GURL& password_form_frame_url) { |
223 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 228 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
224 if (!IsPingingEnabled(kPasswordFieldOnFocusPinging)) | 229 if (!IsPingingEnabled(kPasswordFieldOnFocusPinging)) |
225 return; | 230 return; |
226 | 231 |
227 // Skip URLs that we can't get a reliable reputation for. | 232 // Skip URLs that we can't get a reliable reputation for. |
228 if (!main_frame_url.is_valid() || !main_frame_url.SchemeIsHTTPOrHTTPS()) { | 233 if (!main_frame_url.is_valid() || !main_frame_url.SchemeIsHTTPOrHTTPS()) { |
229 return; | 234 return; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 const std::vector<char> verdict_blob(serialized_proto.begin(), | 483 const std::vector<char> verdict_blob(serialized_proto.begin(), |
479 serialized_proto.end()); | 484 serialized_proto.end()); |
480 std::unique_ptr<base::Value> binary_value = | 485 std::unique_ptr<base::Value> binary_value = |
481 base::MakeUnique<base::Value>(verdict_blob); | 486 base::MakeUnique<base::Value>(verdict_blob); |
482 DCHECK_EQ(base::Value::Type::BINARY, binary_value->type()); | 487 DCHECK_EQ(base::Value::Type::BINARY, binary_value->type()); |
483 result->Set(kVerdictProto, std::move(binary_value)); | 488 result->Set(kVerdictProto, std::move(binary_value)); |
484 return result; | 489 return result; |
485 } | 490 } |
486 | 491 |
487 } // namespace safe_browsing | 492 } // namespace safe_browsing |
OLD | NEW |