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

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

Issue 2929533002: Fill has_password_field for password reuse ping (Closed)
Patch Set: 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"
11 #include "net/base/escape.h" 11 #include "net/base/escape.h"
12 #include "net/base/load_flags.h" 12 #include "net/base/load_flags.h"
13 #include "net/base/url_util.h" 13 #include "net/base/url_util.h"
14 #include "net/http/http_status_code.h" 14 #include "net/http/http_status_code.h"
15 #include "net/traffic_annotation/network_traffic_annotation.h" 15 #include "net/traffic_annotation/network_traffic_annotation.h"
16 16
17 using content::BrowserThread; 17 using content::BrowserThread;
18 using content::WebContents; 18 using content::WebContents;
19 19
20 namespace safe_browsing { 20 namespace safe_browsing {
21 21
22 PasswordProtectionRequest::PasswordProtectionRequest( 22 PasswordProtectionRequest::PasswordProtectionRequest(
23 WebContents* web_contents, 23 WebContents* web_contents,
24 const GURL& main_frame_url, 24 const GURL& main_frame_url,
25 const GURL& password_form_action, 25 const GURL& password_form_action,
26 const GURL& password_form_frame_url, 26 const GURL& password_form_frame_url,
27 const std::string& saved_domain, 27 const std::string& saved_domain,
28 LoginReputationClientRequest::TriggerType type, 28 LoginReputationClientRequest::TriggerType type,
29 bool has_password_field,
29 PasswordProtectionService* pps, 30 PasswordProtectionService* pps,
30 int request_timeout_in_ms) 31 int request_timeout_in_ms)
31 : web_contents_(web_contents), 32 : web_contents_(web_contents),
32 main_frame_url_(main_frame_url), 33 main_frame_url_(main_frame_url),
33 password_form_action_(password_form_action), 34 password_form_action_(password_form_action),
34 password_form_frame_url_(password_form_frame_url), 35 password_form_frame_url_(password_form_frame_url),
35 saved_domain_(saved_domain), 36 saved_domain_(saved_domain),
36 request_type_(type), 37 request_type_(type),
38 has_password_field(has_password_field),
37 password_protection_service_(pps), 39 password_protection_service_(pps),
38 request_timeout_in_ms_(request_timeout_in_ms), 40 request_timeout_in_ms_(request_timeout_in_ms),
39 weakptr_factory_(this) { 41 weakptr_factory_(this) {
40 DCHECK_CURRENTLY_ON(BrowserThread::UI); 42 DCHECK_CURRENTLY_ON(BrowserThread::UI);
41 } 43 }
42 44
43 PasswordProtectionRequest::~PasswordProtectionRequest() { 45 PasswordProtectionRequest::~PasswordProtectionRequest() {
44 weakptr_factory_.InvalidateWeakPtrs(); 46 weakptr_factory_.InvalidateWeakPtrs();
45 } 47 }
46 48
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 password_frame->set_has_password_field(true); 119 password_frame->set_has_password_field(true);
118 // TODO(jialiul): Add referrer chain for subframes later. 120 // TODO(jialiul): Add referrer chain for subframes later.
119 password_form = password_frame->add_forms(); 121 password_form = password_frame->add_forms();
120 } 122 }
121 password_form->set_action_url(password_form_action_.spec()); 123 password_form->set_action_url(password_form_action_.spec());
122 // TODO(jialiul): Fill more frame specific info when Safe Browsing backend 124 // TODO(jialiul): Fill more frame specific info when Safe Browsing backend
123 // is ready to handle these pieces of information. 125 // is ready to handle these pieces of information.
124 break; 126 break;
125 } 127 }
126 case LoginReputationClientRequest::PASSWORD_REUSE_EVENT: { 128 case LoginReputationClientRequest::PASSWORD_REUSE_EVENT: {
129 main_frame->set_has_password_field(has_password_field);
127 // TODO(jialiul): Fill more password reuse related information when ready. 130 // TODO(jialiul): Fill more password reuse related information when ready.
128 break; 131 break;
129 } 132 }
130 default: 133 default:
131 NOTREACHED(); 134 NOTREACHED();
132 } 135 }
133 } 136 }
134 137
135 void PasswordProtectionRequest::SendRequest() { 138 void PasswordProtectionRequest::SendRequest() {
136 DCHECK_CURRENTLY_ON(BrowserThread::UI); 139 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 void PasswordProtectionRequest::Cancel(bool timed_out) { 278 void PasswordProtectionRequest::Cancel(bool timed_out) {
276 DCHECK_CURRENTLY_ON(BrowserThread::UI); 279 DCHECK_CURRENTLY_ON(BrowserThread::UI);
277 fetcher_.reset(); 280 fetcher_.reset();
278 281
279 Finish(timed_out ? PasswordProtectionService::TIMEDOUT 282 Finish(timed_out ? PasswordProtectionService::TIMEDOUT
280 : PasswordProtectionService::CANCELED, 283 : PasswordProtectionService::CANCELED,
281 nullptr); 284 nullptr);
282 } 285 }
283 286
284 } // namespace safe_browsing 287 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698