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

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

Issue 2783773002: Link PasswordProtectionService to Profile and SB Service (Closed)
Patch Set: refine histogram description Created 3 years, 8 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 4cef597c7b7df81e4bbd6b73d9780f537d910c09..e7db6e05543e8d8f801d6e1dd65cec38f4d59a11 100644
--- a/components/safe_browsing/password_protection/password_protection_request.cc
+++ b/components/safe_browsing/password_protection/password_protection_request.cc
@@ -84,7 +84,6 @@ void PasswordProtectionRequest::CheckCachedVerdicts() {
std::unique_ptr<LoginReputationClientResponse> cached_response =
base::MakeUnique<LoginReputationClientResponse>();
auto verdict = password_protection_service_->GetCachedVerdict(
- password_protection_service_->GetSettingMapForActiveProfile(),
main_frame_url_, cached_response.get());
if (verdict != LoginReputationClientResponse::VERDICT_TYPE_UNSPECIFIED)
Finish(RequestOutcome::RESPONSE_ALREADY_CACHED, std::move(cached_response));
@@ -92,17 +91,26 @@ void PasswordProtectionRequest::CheckCachedVerdicts() {
SendRequest();
}
+void PasswordProtectionRequest::FillRequestProto() {
+ request_proto_ = base::MakeUnique<LoginReputationClientRequest>();
+ request_proto_->set_page_url(main_frame_url_.spec());
+ request_proto_->set_trigger_type(request_type_);
+ request_proto_->set_stored_verdict_cnt(
+ password_protection_service_->GetStoredVerdictCount());
+ LoginReputationClientRequest::Frame* main_frame =
+ request_proto_->add_frames();
+ main_frame->set_url(main_frame_url_.spec());
+ password_protection_service_->FillReferrerChain(
+ main_frame_url_, -1 /* tab id not available */, main_frame);
+ // TODO(jialiul): Add sub-frame information and password form information.
+}
+
void PasswordProtectionRequest::SendRequest() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- LoginReputationClientRequest request;
- request.set_page_url(main_frame_url_.spec());
- request.set_trigger_type(request_type_);
- request.set_stored_verdict_cnt(
- password_protection_service_->GetStoredVerdictCount());
+ FillRequestProto();
std::string serialized_request;
- if (!request.SerializeToString(&serialized_request)) {
+ if (!request_proto_->SerializeToString(&serialized_request)) {
Finish(RequestOutcome::REQUEST_MALFORMED, nullptr);
return;
}

Powered by Google App Engine
This is Rietveld 408576698