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

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

Issue 2905343002: Show interstitial on a password on focus ping with PHISHING verdict. (Closed)
Patch Set: nit Created 3 years, 6 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 #include "components/safe_browsing/password_protection/password_protection_reque st.h" 4 #include "components/safe_browsing/password_protection/password_protection_reque st.h"
5 5
6 #include "base/memory/ptr_util.h" 6 #include "base/memory/ptr_util.h"
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "components/data_use_measurement/core/data_use_user_data.h" 9 #include "components/data_use_measurement/core/data_use_user_data.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 tracker_.TryCancelAll(); 240 tracker_.TryCancelAll();
241 241
242 if (request_type_ == LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE) { 242 if (request_type_ == LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE) {
243 UMA_HISTOGRAM_ENUMERATION(kPasswordOnFocusRequestOutcomeHistogramName, 243 UMA_HISTOGRAM_ENUMERATION(kPasswordOnFocusRequestOutcomeHistogramName,
244 outcome, PasswordProtectionService::MAX_OUTCOME); 244 outcome, PasswordProtectionService::MAX_OUTCOME);
245 } else { 245 } else {
246 UMA_HISTOGRAM_ENUMERATION(kPasswordEntryRequestOutcomeHistogramName, 246 UMA_HISTOGRAM_ENUMERATION(kPasswordEntryRequestOutcomeHistogramName,
247 outcome, PasswordProtectionService::MAX_OUTCOME); 247 outcome, PasswordProtectionService::MAX_OUTCOME);
248 } 248 }
249 249
250 if (response) { 250 if (outcome == PasswordProtectionService::SUCCEEDED && response) {
251 switch (request_type_) { 251 switch (request_type_) {
252 case LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE: 252 case LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE:
253 UMA_HISTOGRAM_ENUMERATION( 253 UMA_HISTOGRAM_ENUMERATION(
254 "PasswordProtection.Verdict.PasswordFieldOnFocus", 254 "PasswordProtection.Verdict.PasswordFieldOnFocus",
255 response->verdict_type(), 255 response->verdict_type(),
256 LoginReputationClientResponse_VerdictType_VerdictType_MAX + 1); 256 LoginReputationClientResponse_VerdictType_VerdictType_MAX + 1);
257 break; 257 break;
258 case LoginReputationClientRequest::PASSWORD_REUSE_EVENT: 258 case LoginReputationClientRequest::PASSWORD_REUSE_EVENT:
259 UMA_HISTOGRAM_ENUMERATION( 259 UMA_HISTOGRAM_ENUMERATION(
260 "PasswordProtection.Verdict.ProtectedPasswordEntry", 260 "PasswordProtection.Verdict.ProtectedPasswordEntry",
261 response->verdict_type(), 261 response->verdict_type(),
262 LoginReputationClientResponse_VerdictType_VerdictType_MAX + 1); 262 LoginReputationClientResponse_VerdictType_VerdictType_MAX + 1);
263 break; 263 break;
264 default: 264 default:
265 NOTREACHED(); 265 NOTREACHED();
266 } 266 }
267 } 267 }
268 268
269 DCHECK(password_protection_service_); 269 DCHECK(password_protection_service_);
270 password_protection_service_->RequestFinished(this, std::move(response)); 270 password_protection_service_->RequestFinished(
271 this, outcome == PasswordProtectionService::RESPONSE_ALREADY_CACHED,
272 std::move(response));
271 } 273 }
272 274
273 void PasswordProtectionRequest::Cancel(bool timed_out) { 275 void PasswordProtectionRequest::Cancel(bool timed_out) {
274 DCHECK_CURRENTLY_ON(BrowserThread::UI); 276 DCHECK_CURRENTLY_ON(BrowserThread::UI);
275 fetcher_.reset(); 277 fetcher_.reset();
276 278
277 Finish(timed_out ? PasswordProtectionService::TIMEDOUT 279 Finish(timed_out ? PasswordProtectionService::TIMEDOUT
278 : PasswordProtectionService::CANCELED, 280 : PasswordProtectionService::CANCELED,
279 nullptr); 281 nullptr);
280 } 282 }
281 283
282 } // namespace safe_browsing 284 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698