Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "google_apis/gaia/gaia_urls.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 Loading... | |
| 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 const url::Origin gaia_origin( | |
| 132 GaiaUrls::GetInstance()->gaia_url().GetOrigin()); | |
| 133 reuse_event->set_is_chrome_signin_password( | |
|
Nathan Parker
2017/05/31 22:40:55
I think we want to know that this password matches
Jialiu Lin
2017/06/01 01:22:01
You're right. I overlooked this possibility.
My la
| |
| 134 url::Origin(GURL(saved_domain_)).IsSameOriginWith(gaia_origin)); | |
| 128 break; | 135 break; |
| 129 } | 136 } |
| 130 default: | 137 default: |
| 131 NOTREACHED(); | 138 NOTREACHED(); |
| 132 } | 139 } |
| 133 } | 140 } |
| 134 | 141 |
| 135 void PasswordProtectionRequest::SendRequest() { | 142 void PasswordProtectionRequest::SendRequest() { |
| 136 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 143 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 137 FillRequestProto(); | 144 FillRequestProto(); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 void PasswordProtectionRequest::Cancel(bool timed_out) { | 280 void PasswordProtectionRequest::Cancel(bool timed_out) { |
| 274 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 281 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 275 fetcher_.reset(); | 282 fetcher_.reset(); |
| 276 | 283 |
| 277 Finish(timed_out ? PasswordProtectionService::TIMEDOUT | 284 Finish(timed_out ? PasswordProtectionService::TIMEDOUT |
| 278 : PasswordProtectionService::CANCELED, | 285 : PasswordProtectionService::CANCELED, |
| 279 nullptr); | 286 nullptr); |
| 280 } | 287 } |
| 281 | 288 |
| 282 } // namespace safe_browsing | 289 } // namespace safe_browsing |
| OLD | NEW |