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

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

Issue 2833193002: Trigger Password Protection ping on username/password field on focus (Closed)
Patch Set: nit Created 3 years, 7 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 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 RESPONSE_ALREADY_CACHED = 5, 51 RESPONSE_ALREADY_CACHED = 5,
52 NO_EXTENDED_REPORTING = 6, 52 NO_EXTENDED_REPORTING = 6,
53 INCOGNITO = 7, 53 INCOGNITO = 7,
54 REQUEST_MALFORMED = 8, 54 REQUEST_MALFORMED = 8,
55 FETCH_FAILED = 9, 55 FETCH_FAILED = 9,
56 RESPONSE_MALFORMED = 10, 56 RESPONSE_MALFORMED = 10,
57 SERVICE_DESTROYED = 11, 57 SERVICE_DESTROYED = 11,
58 MAX_OUTCOME 58 MAX_OUTCOME
59 }; 59 };
60 60
61 PasswordProtectionRequest( 61 PasswordProtectionRequest(const GURL& main_frame_url,
62 const GURL& main_frame_url, 62 const GURL& password_form_action,
63 LoginReputationClientRequest::TriggerType type, 63 const GURL& password_form_frame_url,
64 std::unique_ptr<PasswordProtectionFrameList> pending_password_frames, 64 LoginReputationClientRequest::TriggerType type,
65 PasswordProtectionService* pps, 65 PasswordProtectionService* pps,
66 int request_timeout_in_ms); 66 int request_timeout_in_ms);
67 67
68 base::WeakPtr<PasswordProtectionRequest> GetWeakPtr() { 68 base::WeakPtr<PasswordProtectionRequest> GetWeakPtr() {
69 return weakptr_factory_.GetWeakPtr(); 69 return weakptr_factory_.GetWeakPtr();
70 } 70 }
71 71
72 // Starts processing request by checking extended reporting and incognito 72 // Starts processing request by checking extended reporting and incognito
73 // conditions. 73 // conditions.
74 void Start(); 74 void Start();
75 75
76 // Cancels the current request. |timed_out| indicates if this cancellation is 76 // Cancels the current request. |timed_out| indicates if this cancellation is
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 void SendRequest(); 112 void SendRequest();
113 113
114 // Start a timer to cancel the request if it takes too long. 114 // Start a timer to cancel the request if it takes too long.
115 void StartTimeout(); 115 void StartTimeout();
116 116
117 // |this| will be destroyed after calling this function. 117 // |this| will be destroyed after calling this function.
118 void Finish(RequestOutcome outcome, 118 void Finish(RequestOutcome outcome,
119 std::unique_ptr<LoginReputationClientResponse> response); 119 std::unique_ptr<LoginReputationClientResponse> response);
120 120
121 // Main frame URL of the login form. 121 // Main frame URL of the login form.
122 GURL main_frame_url_; 122 const GURL main_frame_url_;
123
124 // The action URL of the password form.
125 const GURL password_form_action_;
126
127 // Frame url of the detected password form.
128 const GURL password_form_frame_url_;
123 129
124 // If this request is for unfamiliar login page or for a password reuse event. 130 // If this request is for unfamiliar login page or for a password reuse event.
125 const LoginReputationClientRequest::TriggerType request_type_; 131 const LoginReputationClientRequest::TriggerType request_type_;
126 132
127 // The list of PasswordProtectionFrame this request is concerning.
128 std::unique_ptr<PasswordProtectionFrameList> password_frames_;
129
130 // When request is sent. 133 // When request is sent.
131 base::TimeTicks request_start_time_; 134 base::TimeTicks request_start_time_;
132 135
133 // URLFetcher instance for sending request and receiving response. 136 // URLFetcher instance for sending request and receiving response.
134 std::unique_ptr<net::URLFetcher> fetcher_; 137 std::unique_ptr<net::URLFetcher> fetcher_;
135 138
136 // The PasswordProtectionService instance owns |this|. 139 // The PasswordProtectionService instance owns |this|.
137 // Can only be accessed on UI thread. 140 // Can only be accessed on UI thread.
138 PasswordProtectionService* password_protection_service_; 141 PasswordProtectionService* password_protection_service_;
139 142
(...skipping 10 matching lines...) Expand all
150 // Needed for canceling tasks posted to different threads. 153 // Needed for canceling tasks posted to different threads.
151 base::CancelableTaskTracker tracker_; 154 base::CancelableTaskTracker tracker_;
152 155
153 base::WeakPtrFactory<PasswordProtectionRequest> weakptr_factory_; 156 base::WeakPtrFactory<PasswordProtectionRequest> weakptr_factory_;
154 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionRequest); 157 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionRequest);
155 }; 158 };
156 159
157 } // namespace safe_browsing 160 } // namespace safe_browsing
158 161
159 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQU EST_H_ 162 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQU EST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698