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

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

Issue 2911293003: Reland: Cache protected password entry and password on focus ping separately. (Closed)
Patch Set: Fix Crashes by Using GetDictionaryWithoutPathExpansion 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 side-by-side diff with in-line comments
Download patch
Index: components/safe_browsing/password_protection/password_protection_request.cc
diff --git a/components/safe_browsing/password_protection/password_protection_request.cc b/components/safe_browsing/password_protection/password_protection_request.cc
index 909c84891e2452a12116414b9145652ae3daea56..f23e47eddc7ac07bc08669341784343bef77ff29 100644
--- a/components/safe_browsing/password_protection/password_protection_request.cc
+++ b/components/safe_browsing/password_protection/password_protection_request.cc
@@ -36,12 +36,14 @@ PasswordProtectionRequest::PasswordProtectionRequest(
password_form_action_(password_form_action),
password_form_frame_url_(password_form_frame_url),
saved_domain_(saved_domain),
- request_type_(type),
+ trigger_type_(type),
password_field_exists_(password_field_exists),
password_protection_service_(pps),
request_timeout_in_ms_(request_timeout_in_ms),
weakptr_factory_(this) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK(trigger_type_ == LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE ||
+ trigger_type_ == LoginReputationClientRequest::PASSWORD_REUSE_EVENT);
}
PasswordProtectionRequest::~PasswordProtectionRequest() {
@@ -85,7 +87,7 @@ void PasswordProtectionRequest::CheckCachedVerdicts() {
std::unique_ptr<LoginReputationClientResponse> cached_response =
base::MakeUnique<LoginReputationClientResponse>();
auto verdict = password_protection_service_->GetCachedVerdict(
- main_frame_url_, cached_response.get());
+ main_frame_url_, trigger_type_, cached_response.get());
if (verdict != LoginReputationClientResponse::VERDICT_TYPE_UNSPECIFIED)
Finish(PasswordProtectionService::RESPONSE_ALREADY_CACHED,
std::move(cached_response));
@@ -96,11 +98,11 @@ void PasswordProtectionRequest::CheckCachedVerdicts() {
void PasswordProtectionRequest::FillRequestProto() {
request_proto_ = base::MakeUnique<LoginReputationClientRequest>();
request_proto_->set_page_url(main_frame_url_.spec());
- request_proto_->set_trigger_type(request_type_);
- password_protection_service_->FillUserPopulation(request_type_,
+ request_proto_->set_trigger_type(trigger_type_);
+ password_protection_service_->FillUserPopulation(trigger_type_,
request_proto_.get());
request_proto_->set_stored_verdict_cnt(
- password_protection_service_->GetStoredVerdictCount());
+ password_protection_service_->GetStoredVerdictCount(trigger_type_));
LoginReputationClientRequest::Frame* main_frame =
request_proto_->add_frames();
main_frame->set_url(main_frame_url_.spec());
@@ -108,7 +110,7 @@ void PasswordProtectionRequest::FillRequestProto() {
password_protection_service_->FillReferrerChain(
main_frame_url_, -1 /* tab id not available */, main_frame);
- switch (request_type_) {
+ switch (trigger_type_) {
case LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE: {
LoginReputationClientRequest::Frame::Form* password_form;
if (password_form_frame_url_ == main_frame_url_) {
@@ -247,7 +249,7 @@ void PasswordProtectionRequest::Finish(
DCHECK_CURRENTLY_ON(BrowserThread::UI);
tracker_.TryCancelAll();
- if (request_type_ == LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE) {
+ if (trigger_type_ == LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE) {
UMA_HISTOGRAM_ENUMERATION(kPasswordOnFocusRequestOutcomeHistogramName,
outcome, PasswordProtectionService::MAX_OUTCOME);
} else {
@@ -256,7 +258,7 @@ void PasswordProtectionRequest::Finish(
}
if (outcome == PasswordProtectionService::SUCCEEDED && response) {
- switch (request_type_) {
+ switch (trigger_type_) {
case LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE:
UMA_HISTOGRAM_ENUMERATION(
"PasswordProtection.Verdict.PasswordFieldOnFocus",

Powered by Google App Engine
This is Rietveld 408576698