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 | 4 |
| 5 #ifndef COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQUEST _H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQUEST _H_ |
| 6 #define COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQUEST _H_ | 6 #define COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQUEST _H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/task/cancelable_task_tracker.h" | 10 #include "base/task/cancelable_task_tracker.h" |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 PasswordProtectionRequest, | 39 PasswordProtectionRequest, |
| 40 content::BrowserThread::DeleteOnUIThread>, | 40 content::BrowserThread::DeleteOnUIThread>, |
| 41 public net::URLFetcherDelegate { | 41 public net::URLFetcherDelegate { |
| 42 public: | 42 public: |
| 43 PasswordProtectionRequest(content::WebContents* web_contents, | 43 PasswordProtectionRequest(content::WebContents* web_contents, |
| 44 const GURL& main_frame_url, | 44 const GURL& main_frame_url, |
| 45 const GURL& password_form_action, | 45 const GURL& password_form_action, |
| 46 const GURL& password_form_frame_url, | 46 const GURL& password_form_frame_url, |
| 47 const std::string& saved_domain, | 47 const std::string& saved_domain, |
| 48 LoginReputationClientRequest::TriggerType type, | 48 LoginReputationClientRequest::TriggerType type, |
| 49 bool has_password_field, | |
| 49 PasswordProtectionService* pps, | 50 PasswordProtectionService* pps, |
| 50 int request_timeout_in_ms); | 51 int request_timeout_in_ms); |
| 51 | 52 |
| 52 base::WeakPtr<PasswordProtectionRequest> GetWeakPtr() { | 53 base::WeakPtr<PasswordProtectionRequest> GetWeakPtr() { |
| 53 return weakptr_factory_.GetWeakPtr(); | 54 return weakptr_factory_.GetWeakPtr(); |
| 54 } | 55 } |
| 55 | 56 |
| 56 // Starts processing request by checking extended reporting and incognito | 57 // Starts processing request by checking extended reporting and incognito |
| 57 // conditions. | 58 // conditions. |
| 58 void Start(); | 59 void Start(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 | 124 |
| 124 // Frame url of the detected password form. | 125 // Frame url of the detected password form. |
| 125 const GURL password_form_frame_url_; | 126 const GURL password_form_frame_url_; |
| 126 | 127 |
| 127 // Domain on which a password is saved and gets reused. | 128 // Domain on which a password is saved and gets reused. |
| 128 const std::string saved_domain_; | 129 const std::string saved_domain_; |
| 129 | 130 |
| 130 // If this request is for unfamiliar login page or for a password reuse event. | 131 // If this request is for unfamiliar login page or for a password reuse event. |
| 131 const LoginReputationClientRequest::TriggerType request_type_; | 132 const LoginReputationClientRequest::TriggerType request_type_; |
| 132 | 133 |
| 134 // If there is a password field on the page. | |
| 135 const bool has_password_field; | |
|
lpz
2017/06/07 13:54:24
include the trailing _
nit: also consider renamin
Jialiu Lin
2017/06/07 21:12:33
Ah, can't believe I made this mistake. And "passwo
| |
| 136 | |
| 133 // When request is sent. | 137 // When request is sent. |
| 134 base::TimeTicks request_start_time_; | 138 base::TimeTicks request_start_time_; |
| 135 | 139 |
| 136 // URLFetcher instance for sending request and receiving response. | 140 // URLFetcher instance for sending request and receiving response. |
| 137 std::unique_ptr<net::URLFetcher> fetcher_; | 141 std::unique_ptr<net::URLFetcher> fetcher_; |
| 138 | 142 |
| 139 // The PasswordProtectionService instance owns |this|. | 143 // The PasswordProtectionService instance owns |this|. |
| 140 // Can only be accessed on UI thread. | 144 // Can only be accessed on UI thread. |
| 141 PasswordProtectionService* password_protection_service_; | 145 PasswordProtectionService* password_protection_service_; |
| 142 | 146 |
| 143 // If we haven't receive response after this period of time, we cancel this | 147 // If we haven't receive response after this period of time, we cancel this |
| 144 // request. | 148 // request. |
| 145 const int request_timeout_in_ms_; | 149 const int request_timeout_in_ms_; |
| 146 | 150 |
| 147 std::unique_ptr<LoginReputationClientRequest> request_proto_; | 151 std::unique_ptr<LoginReputationClientRequest> request_proto_; |
| 148 | 152 |
| 149 // Needed for canceling tasks posted to different threads. | 153 // Needed for canceling tasks posted to different threads. |
| 150 base::CancelableTaskTracker tracker_; | 154 base::CancelableTaskTracker tracker_; |
| 151 | 155 |
| 152 base::WeakPtrFactory<PasswordProtectionRequest> weakptr_factory_; | 156 base::WeakPtrFactory<PasswordProtectionRequest> weakptr_factory_; |
| 153 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionRequest); | 157 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionRequest); |
| 154 }; | 158 }; |
| 155 | 159 |
| 156 } // namespace safe_browsing | 160 } // namespace safe_browsing |
| 157 | 161 |
| 158 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQU EST_H_ | 162 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQU EST_H_ |
| OLD | NEW |