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

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

Issue 2833193002: Trigger Password Protection ping on username/password field on focus (Closed)
Patch Set: nit 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 eb0ed1b98a0e2885204304daa379255ea11d4f5f..2827ed46d5687c72e762317505473644e40c8ada 100644
--- a/components/safe_browsing/password_protection/password_protection_request.cc
+++ b/components/safe_browsing/password_protection/password_protection_request.cc
@@ -19,13 +19,15 @@ namespace safe_browsing {
PasswordProtectionRequest::PasswordProtectionRequest(
const GURL& main_frame_url,
+ const GURL& password_form_action,
+ const GURL& password_form_frame_url,
LoginReputationClientRequest::TriggerType type,
- std::unique_ptr<PasswordProtectionFrameList> password_frames,
PasswordProtectionService* pps,
int request_timeout_in_ms)
: main_frame_url_(main_frame_url),
+ password_form_action_(password_form_action),
+ password_form_frame_url_(password_form_frame_url),
request_type_(type),
- password_frames_(std::move(password_frames)),
password_protection_service_(pps),
database_manager_(password_protection_service_->database_manager()),
request_timeout_in_ms_(request_timeout_in_ms),
@@ -101,13 +103,24 @@ void PasswordProtectionRequest::FillRequestProto() {
request_proto_->add_frames();
main_frame->set_url(main_frame_url_.spec());
main_frame->set_frame_index(0 /* main frame */);
- main_frame->set_has_password_field(true);
password_protection_service_->FillReferrerChain(
main_frame_url_, -1 /* tab id not available */, main_frame);
-
- // TODO(jialiul): Fill more password form related info based on
- // |password_frame_map_| when Safe Browsing backend is ready to handle these
- // pieces of information.
+ LoginReputationClientRequest::Frame::Form* password_form;
+ if (password_form_frame_url_ == main_frame_url_) {
+ main_frame->set_has_password_field(true);
+ password_form = main_frame->add_forms();
+ } else {
+ LoginReputationClientRequest::Frame* password_frame =
+ request_proto_->add_frames();
+ password_frame->set_url(password_form_frame_url_.spec());
+ password_frame->set_has_password_field(true);
+ // TODO(jialiul): Add referrer chain for subframes later.
+ password_form = password_frame->add_forms();
+ }
+ password_form->set_action_url(password_form_action_.spec());
+ password_form->set_has_password_field(true);
+ // TODO(jialiul): Fill more frame specific info when Safe Browsing backend
+ // is ready to handle these pieces of information.
}
void PasswordProtectionRequest::SendRequest() {

Powered by Google App Engine
This is Rietveld 408576698