| 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 "components/password_manager/core/browser/password_reuse_detector.h" | 10 #include "components/password_manager/core/browser/password_reuse_detector.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace safe_browsing { | 22 namespace safe_browsing { |
| 23 | 23 |
| 24 PasswordProtectionRequest::PasswordProtectionRequest( | 24 PasswordProtectionRequest::PasswordProtectionRequest( |
| 25 WebContents* web_contents, | 25 WebContents* web_contents, |
| 26 const GURL& main_frame_url, | 26 const GURL& main_frame_url, |
| 27 const GURL& password_form_action, | 27 const GURL& password_form_action, |
| 28 const GURL& password_form_frame_url, | 28 const GURL& password_form_frame_url, |
| 29 const std::string& saved_domain, | 29 const std::string& saved_domain, |
| 30 LoginReputationClientRequest::TriggerType type, | 30 LoginReputationClientRequest::TriggerType type, |
| 31 bool password_field_exists, |
| 31 PasswordProtectionService* pps, | 32 PasswordProtectionService* pps, |
| 32 int request_timeout_in_ms) | 33 int request_timeout_in_ms) |
| 33 : web_contents_(web_contents), | 34 : web_contents_(web_contents), |
| 34 main_frame_url_(main_frame_url), | 35 main_frame_url_(main_frame_url), |
| 35 password_form_action_(password_form_action), | 36 password_form_action_(password_form_action), |
| 36 password_form_frame_url_(password_form_frame_url), | 37 password_form_frame_url_(password_form_frame_url), |
| 37 saved_domain_(saved_domain), | 38 saved_domain_(saved_domain), |
| 38 request_type_(type), | 39 request_type_(type), |
| 40 password_field_exists_(password_field_exists), |
| 39 password_protection_service_(pps), | 41 password_protection_service_(pps), |
| 40 request_timeout_in_ms_(request_timeout_in_ms), | 42 request_timeout_in_ms_(request_timeout_in_ms), |
| 41 weakptr_factory_(this) { | 43 weakptr_factory_(this) { |
| 42 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 44 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 43 } | 45 } |
| 44 | 46 |
| 45 PasswordProtectionRequest::~PasswordProtectionRequest() { | 47 PasswordProtectionRequest::~PasswordProtectionRequest() { |
| 46 weakptr_factory_.InvalidateWeakPtrs(); | 48 weakptr_factory_.InvalidateWeakPtrs(); |
| 47 } | 49 } |
| 48 | 50 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 password_frame->set_has_password_field(true); | 121 password_frame->set_has_password_field(true); |
| 120 // TODO(jialiul): Add referrer chain for subframes later. | 122 // TODO(jialiul): Add referrer chain for subframes later. |
| 121 password_form = password_frame->add_forms(); | 123 password_form = password_frame->add_forms(); |
| 122 } | 124 } |
| 123 password_form->set_action_url(password_form_action_.spec()); | 125 password_form->set_action_url(password_form_action_.spec()); |
| 124 // TODO(jialiul): Fill more frame specific info when Safe Browsing backend | 126 // TODO(jialiul): Fill more frame specific info when Safe Browsing backend |
| 125 // is ready to handle these pieces of information. | 127 // is ready to handle these pieces of information. |
| 126 break; | 128 break; |
| 127 } | 129 } |
| 128 case LoginReputationClientRequest::PASSWORD_REUSE_EVENT: { | 130 case LoginReputationClientRequest::PASSWORD_REUSE_EVENT: { |
| 131 main_frame->set_has_password_field(password_field_exists_); |
| 129 LoginReputationClientRequest::PasswordReuseEvent* reuse_event = | 132 LoginReputationClientRequest::PasswordReuseEvent* reuse_event = |
| 130 request_proto_->mutable_password_reuse_event(); | 133 request_proto_->mutable_password_reuse_event(); |
| 131 reuse_event->set_is_chrome_signin_password( | 134 reuse_event->set_is_chrome_signin_password( |
| 132 saved_domain_ == std::string(password_manager::kSyncPasswordDomain)); | 135 saved_domain_ == std::string(password_manager::kSyncPasswordDomain)); |
| 133 break; | 136 break; |
| 134 } | 137 } |
| 135 default: | 138 default: |
| 136 NOTREACHED(); | 139 NOTREACHED(); |
| 137 } | 140 } |
| 138 } | 141 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 void PasswordProtectionRequest::Cancel(bool timed_out) { | 283 void PasswordProtectionRequest::Cancel(bool timed_out) { |
| 281 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 284 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 282 fetcher_.reset(); | 285 fetcher_.reset(); |
| 283 | 286 |
| 284 Finish(timed_out ? PasswordProtectionService::TIMEDOUT | 287 Finish(timed_out ? PasswordProtectionService::TIMEDOUT |
| 285 : PasswordProtectionService::CANCELED, | 288 : PasswordProtectionService::CANCELED, |
| 286 nullptr); | 289 nullptr); |
| 287 } | 290 } |
| 288 | 291 |
| 289 } // namespace safe_browsing | 292 } // namespace safe_browsing |
| OLD | NEW |