OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 #include "components/autofill/core/common/password_form_fill_data.h" | 14 #include "components/autofill/core/common/password_form_fill_data.h" |
14 #include "content/public/renderer/render_view_observer.h" | 15 #include "content/public/renderer/render_view_observer.h" |
15 #include "third_party/WebKit/public/web/WebInputElement.h" | 16 #include "third_party/WebKit/public/web/WebInputElement.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 class WebInputElement; | 19 class WebInputElement; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 OTHER_POSSIBLE_USERNAMES_MAX | 85 OTHER_POSSIBLE_USERNAMES_MAX |
85 }; | 86 }; |
86 | 87 |
87 struct PasswordInfo { | 88 struct PasswordInfo { |
88 blink::WebInputElement password_field; | 89 blink::WebInputElement password_field; |
89 PasswordFormFillData fill_data; | 90 PasswordFormFillData fill_data; |
90 bool backspace_pressed_last; | 91 bool backspace_pressed_last; |
91 PasswordInfo() : backspace_pressed_last(false) {} | 92 PasswordInfo() : backspace_pressed_last(false) {} |
92 }; | 93 }; |
93 typedef std::map<blink::WebElement, PasswordInfo> LoginToPasswordInfoMap; | 94 typedef std::map<blink::WebElement, PasswordInfo> LoginToPasswordInfoMap; |
95 typedef std::map<blink::WebElement, blink::WebElement> PasswordToLoginMap; | |
94 typedef std::map<blink::WebFrame*, | 96 typedef std::map<blink::WebFrame*, |
95 linked_ptr<PasswordForm> > FrameToPasswordFormMap; | 97 linked_ptr<PasswordForm> > FrameToPasswordFormMap; |
96 | 98 |
97 // This class holds a vector of autofilled password input elements and makes | 99 // This class holds a vector of autofilled password input elements and makes |
98 // sure the autofilled password value is not accessible to JavaScript code | 100 // sure the autofilled password value is not accessible to JavaScript code |
99 // until the user interacts with the page. | 101 // until the user interacts with the page. |
100 class PasswordValueGatekeeper { | 102 class PasswordValueGatekeeper { |
101 public: | 103 public: |
102 PasswordValueGatekeeper(); | 104 PasswordValueGatekeeper(); |
103 ~PasswordValueGatekeeper(); | 105 ~PasswordValueGatekeeper(); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 void ClearPreview(blink::WebInputElement* username, | 193 void ClearPreview(blink::WebInputElement* username, |
192 blink::WebInputElement* password); | 194 blink::WebInputElement* password); |
193 | 195 |
194 // If |provisionally_saved_forms_| contains a form for |current_frame| or its | 196 // If |provisionally_saved_forms_| contains a form for |current_frame| or its |
195 // children, return such frame. | 197 // children, return such frame. |
196 blink::WebFrame* CurrentOrChildFrameWithSavedForms( | 198 blink::WebFrame* CurrentOrChildFrameWithSavedForms( |
197 const blink::WebFrame* current_frame); | 199 const blink::WebFrame* current_frame); |
198 | 200 |
199 // The logins we have filled so far with their associated info. | 201 // The logins we have filled so far with their associated info. |
200 LoginToPasswordInfoMap login_to_password_info_; | 202 LoginToPasswordInfoMap login_to_password_info_; |
203 PasswordToLoginMap password_to_username_; | |
201 | 204 |
202 // Used for UMA stats. | 205 // Used for UMA stats. |
203 OtherPossibleUsernamesUsage usernames_usage_; | 206 OtherPossibleUsernamesUsage usernames_usage_; |
204 | 207 |
205 // Pointer to the WebView. Used to access page scale factor. | 208 // Pointer to the WebView. Used to access page scale factor. |
206 blink::WebView* web_view_; | 209 blink::WebView* web_view_; |
207 | 210 |
208 // Set if the user might be submitting a password form on the current page, | 211 // Set if the user might be submitting a password form on the current page, |
209 // but the submit may still fail (i.e. doesn't pass JavaScript validation). | 212 // but the submit may still fail (i.e. doesn't pass JavaScript validation). |
210 FrameToPasswordFormMap provisionally_saved_forms_; | 213 FrameToPasswordFormMap provisionally_saved_forms_; |
211 | 214 |
212 PasswordValueGatekeeper gatekeeper_; | 215 PasswordValueGatekeeper gatekeeper_; |
213 | 216 |
214 // True indicates that user debug information should be logged. | 217 // True indicates that user debug information should be logged. |
215 bool logging_state_active_; | 218 bool logging_state_active_; |
216 | 219 |
217 // True indicates that the username field was autofilled, false otherwise. | 220 // True indicates that the username field was autofilled, false otherwise. |
218 bool was_username_autofilled_; | 221 bool was_username_autofilled_; |
219 // True indicates that the password field was autofilled, false otherwise. | 222 // True indicates that the password field was autofilled, false otherwise. |
220 bool was_password_autofilled_; | 223 bool was_password_autofilled_; |
221 | 224 |
222 // Records original starting point of username element's selection range | 225 // Records original starting point of username element's selection range |
223 // before preview. | 226 // before preview. |
224 int username_selection_start_; | 227 int username_selection_start_; |
225 | 228 |
226 // True indicates that all frames in a page have been rendered. | 229 // True indicates that all frames in a page have been rendered. |
227 bool did_stop_loading_; | 230 bool did_stop_loading_; |
228 | 231 |
232 // The set of all username elements, for which the corresponding password | |
engedy
2014/07/29 14:43:54
As discussed offline, we should just add this to P
vabr (Chromium)
2014/07/29 15:12:30
Done.
| |
233 // fields should not be filled at the moment. This includes cases, where the | |
234 // user chose a suggestion, then changed the filled password, then entered and | |
235 // left the username field again without change. | |
236 std::set<blink::WebElement> temporary_disabled_password_fill_; | |
237 | |
229 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 238 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
230 | 239 |
231 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 240 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
232 }; | 241 }; |
233 | 242 |
234 } // namespace autofill | 243 } // namespace autofill |
235 | 244 |
236 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 245 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
OLD | NEW |