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

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

Issue 2912383004: Fill is_chrome_signin_password field in the password entry pings. (Closed)
Patch Set: address nparker's comments 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 "components/password_manager/core/browser/password_reuse_detector.h"
10 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
11 #include "net/base/escape.h" 12 #include "net/base/escape.h"
12 #include "net/base/load_flags.h" 13 #include "net/base/load_flags.h"
13 #include "net/base/url_util.h" 14 #include "net/base/url_util.h"
14 #include "net/http/http_status_code.h" 15 #include "net/http/http_status_code.h"
15 #include "net/traffic_annotation/network_traffic_annotation.h" 16 #include "net/traffic_annotation/network_traffic_annotation.h"
17 #include "url/origin.h"
16 18
17 using content::BrowserThread; 19 using content::BrowserThread;
18 using content::WebContents; 20 using content::WebContents;
19 21
20 namespace safe_browsing { 22 namespace safe_browsing {
21 23
22 PasswordProtectionRequest::PasswordProtectionRequest( 24 PasswordProtectionRequest::PasswordProtectionRequest(
23 WebContents* web_contents, 25 WebContents* web_contents,
24 const GURL& main_frame_url, 26 const GURL& main_frame_url,
25 const GURL& password_form_action, 27 const GURL& password_form_action,
(...skipping 91 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: {
127 // TODO(jialiul): Fill more password reuse related information when ready. 129 LoginReputationClientRequest::PasswordReuseEvent* reuse_event =
130 request_proto_->mutable_password_reuse_event();
131 reuse_event->set_is_chrome_signin_password(
132 saved_domain_ == std::string(password_manager::kSyncPasswordDomain));
128 break; 133 break;
129 } 134 }
130 default: 135 default:
131 NOTREACHED(); 136 NOTREACHED();
132 } 137 }
133 } 138 }
134 139
135 void PasswordProtectionRequest::SendRequest() { 140 void PasswordProtectionRequest::SendRequest() {
136 DCHECK_CURRENTLY_ON(BrowserThread::UI); 141 DCHECK_CURRENTLY_ON(BrowserThread::UI);
137 FillRequestProto(); 142 FillRequestProto();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 void PasswordProtectionRequest::Cancel(bool timed_out) { 280 void PasswordProtectionRequest::Cancel(bool timed_out) {
276 DCHECK_CURRENTLY_ON(BrowserThread::UI); 281 DCHECK_CURRENTLY_ON(BrowserThread::UI);
277 fetcher_.reset(); 282 fetcher_.reset();
278 283
279 Finish(timed_out ? PasswordProtectionService::TIMEDOUT 284 Finish(timed_out ? PasswordProtectionService::TIMEDOUT
280 : PasswordProtectionService::CANCELED, 285 : PasswordProtectionService::CANCELED,
281 nullptr); 286 nullptr);
282 } 287 }
283 288
284 } // namespace safe_browsing 289 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698