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

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& action_url,
63 LoginReputationClientRequest::TriggerType type, 63 LoginReputationClientRequest::TriggerType type,
64 std::unique_ptr<PasswordProtectionFrameList> pending_password_frames, 64 PasswordProtectionService* pps,
65 PasswordProtectionService* pps, 65 int request_timeout_in_ms);
66 int request_timeout_in_ms);
67 66
68 base::WeakPtr<PasswordProtectionRequest> GetWeakPtr() { 67 base::WeakPtr<PasswordProtectionRequest> GetWeakPtr() {
69 return weakptr_factory_.GetWeakPtr(); 68 return weakptr_factory_.GetWeakPtr();
70 } 69 }
71 70
72 // Starts processing request by checking extended reporting and incognito 71 // Starts processing request by checking extended reporting and incognito
73 // conditions. 72 // conditions.
74 void Start(); 73 void Start();
75 74
76 // Cancels the current request. |timed_out| indicates if this cancellation is 75 // Cancels the current request. |timed_out| indicates if this cancellation is
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Start a timer to cancel the request if it takes too long. 113 // Start a timer to cancel the request if it takes too long.
115 void StartTimeout(); 114 void StartTimeout();
116 115
117 // |this| will be destroyed after calling this function. 116 // |this| will be destroyed after calling this function.
118 void Finish(RequestOutcome outcome, 117 void Finish(RequestOutcome outcome,
119 std::unique_ptr<LoginReputationClientResponse> response); 118 std::unique_ptr<LoginReputationClientResponse> response);
120 119
121 // Main frame URL of the login form. 120 // Main frame URL of the login form.
122 GURL main_frame_url_; 121 GURL main_frame_url_;
123 122
123 // The action URL of the password form.
124 GURL password_form_action_;
125
124 // If this request is for unfamiliar login page or for a password reuse event. 126 // If this request is for unfamiliar login page or for a password reuse event.
125 const LoginReputationClientRequest::TriggerType request_type_; 127 const LoginReputationClientRequest::TriggerType request_type_;
126 128
127 // The list of PasswordProtectionFrame this request is concerning.
128 std::unique_ptr<PasswordProtectionFrameList> password_frames_;
129
130 // When request is sent. 129 // When request is sent.
131 base::TimeTicks request_start_time_; 130 base::TimeTicks request_start_time_;
132 131
133 // URLFetcher instance for sending request and receiving response. 132 // URLFetcher instance for sending request and receiving response.
134 std::unique_ptr<net::URLFetcher> fetcher_; 133 std::unique_ptr<net::URLFetcher> fetcher_;
135 134
136 // The PasswordProtectionService instance owns |this|. 135 // The PasswordProtectionService instance owns |this|.
137 // Can only be accessed on UI thread. 136 // Can only be accessed on UI thread.
138 PasswordProtectionService* password_protection_service_; 137 PasswordProtectionService* password_protection_service_;
139 138
(...skipping 10 matching lines...) Expand all
150 // Needed for canceling tasks posted to different threads. 149 // Needed for canceling tasks posted to different threads.
151 base::CancelableTaskTracker tracker_; 150 base::CancelableTaskTracker tracker_;
152 151
153 base::WeakPtrFactory<PasswordProtectionRequest> weakptr_factory_; 152 base::WeakPtrFactory<PasswordProtectionRequest> weakptr_factory_;
154 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionRequest); 153 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionRequest);
155 }; 154 };
156 155
157 } // namespace safe_browsing 156 } // namespace safe_browsing
158 157
159 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQU EST_H_ 158 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQU EST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698