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

Side by Side Diff: components/autofill/content/renderer/password_autofill_agent.h

Issue 208453002: Add "previewing on hover" support for password field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update code as per Ilya's review comments after rebasing code. Created 6 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 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 <vector> 9 #include <vector>
10 10
(...skipping 22 matching lines...) Expand all
33 // WebViewClient editor related calls forwarded by the RenderView. 33 // WebViewClient editor related calls forwarded by the RenderView.
34 // If they return true, it indicates the event was consumed and should not 34 // If they return true, it indicates the event was consumed and should not
35 // be used for any other autofill activity. 35 // be used for any other autofill activity.
36 bool TextFieldDidEndEditing(const blink::WebInputElement& element); 36 bool TextFieldDidEndEditing(const blink::WebInputElement& element);
37 bool TextDidChangeInTextField(const blink::WebInputElement& element); 37 bool TextDidChangeInTextField(const blink::WebInputElement& element);
38 bool TextFieldHandlingKeyDown(const blink::WebInputElement& element, 38 bool TextFieldHandlingKeyDown(const blink::WebInputElement& element,
39 const blink::WebKeyboardEvent& event); 39 const blink::WebKeyboardEvent& event);
40 40
41 // Fills the username and password fields of this form with the given values. 41 // Fills the username and password fields of this form with the given values.
42 // Returns true if the fields were filled, false otherwise. 42 // Returns true if the fields were filled, false otherwise.
43 bool AcceptSuggestion(const blink::WebNode& node, 43 bool FillSuggestion(const blink::WebNode& node,
44 const blink::WebString& username, 44 const blink::WebString& username,
45 const blink::WebString& password); 45 const blink::WebString& password);
Ilya Sherman 2014/05/14 23:10:58 nit: Please leave a blank line after this one.
ziran.sun 2014/05/15 12:36:37 Done.
46 // Previews the username and password fields of this form with the given
47 // values. Returns true if the fields were previewed, false otherwise.
48 bool PreviewSuggestion(const blink::WebNode& node,
49 const blink::WebString& username,
50 const blink::WebString& password);
51 // A public version of ClearPreview(), only for use in tests.
52 bool ClearPreviewForTest(blink::WebInputElement* username,
53 blink::WebInputElement* password);
Ilya Sherman 2014/05/14 23:10:58 nit: Please move this to the very bottom of the "p
ziran.sun 2014/05/15 12:36:37 This function has been removed.
46 54
47 // A no-op. Password forms are not previewed, so they do not need to be 55 // A no-op. Password forms are not previewed, so they do not need to be
48 // cleared when the selection changes. However, this method returns 56 // cleared when the selection changes. However, this method returns
49 // true when |node| is fillable by password Autofill. 57 // true when |node| is fillable by password Autofill.
Ilya Sherman 2014/05/14 23:10:58 Please update this documentation.
ziran.sun 2014/05/15 12:36:37 Done.
50 bool DidClearAutofillSelection(const blink::WebNode& node); 58 bool DidClearAutofillSelection(const blink::WebNode& node);
51 // Shows an Autofill popup with username suggestions for |element|. 59 // Shows an Autofill popup with username suggestions for |element|.
52 // Returns true if any suggestions were shown, false otherwise. 60 // Returns true if any suggestions were shown, false otherwise.
53 bool ShowSuggestions(const blink::WebInputElement& element); 61 bool ShowSuggestions(const blink::WebInputElement& element);
54 62
55 // Called when new form controls are inserted. 63 // Called when new form controls are inserted.
56 void OnDynamicFormsSeen(blink::WebFrame* frame); 64 void OnDynamicFormsSeen(blink::WebFrame* frame);
57 65
58 // Called when the user first interacts with the page after a load. This is a 66 // Called when the user first interacts with the page after a load. This is a
59 // signal to make autofilled values of password input elements accessible to 67 // signal to make autofilled values of password input elements accessible to
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 154
147 // Attempts to fill |username_element| and |password_element| with the 155 // Attempts to fill |username_element| and |password_element| with the
148 // |fill_data|. Will use the data corresponding to the preferred username, 156 // |fill_data|. Will use the data corresponding to the preferred username,
149 // unless the |username_element| already has a value set. In that case, 157 // unless the |username_element| already has a value set. In that case,
150 // attempts to fill the password matching the already filled username, if 158 // attempts to fill the password matching the already filled username, if
151 // such a password exists. 159 // such a password exists.
152 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data, 160 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data,
153 blink::WebInputElement username_element, 161 blink::WebInputElement username_element,
154 blink::WebInputElement password_element); 162 blink::WebInputElement password_element);
155 163
156 bool FillUserNameAndPassword( 164 bool FillUserNameAndPassword(blink::WebInputElement* username_element,
157 blink::WebInputElement* username_element, 165 blink::WebInputElement* password_element,
158 blink::WebInputElement* password_element, 166 const PasswordFormFillData& fill_data,
159 const PasswordFormFillData& fill_data, 167 bool exact_username_match,
160 bool exact_username_match, 168 bool set_selection);
161 bool set_selection);
162 169
163 // Fills |login_input| and |password| with the most relevant suggestion from 170 // Fills |login_input| and |password| with the most relevant suggestion from
164 // |fill_data| and shows a popup with other suggestions. 171 // |fill_data| and shows a popup with other suggestions.
165 void PerformInlineAutocomplete( 172 void PerformInlineAutocomplete(
166 const blink::WebInputElement& username, 173 const blink::WebInputElement& username,
167 const blink::WebInputElement& password, 174 const blink::WebInputElement& password,
168 const PasswordFormFillData& fill_data); 175 const PasswordFormFillData& fill_data);
169 176
170 // Invoked when the passed frame is closing. Gives us a chance to clear any 177 // Invoked when the passed frame is closing. Gives us a chance to clear any
171 // reference we may have to elements in that frame. 178 // reference we may have to elements in that frame.
172 void FrameClosing(const blink::WebFrame* frame); 179 void FrameClosing(const blink::WebFrame* frame);
173 180
174 // Finds login information for a |node| that was previously filled. 181 // Finds login information for a |node| that was previously filled.
175 bool FindLoginInfo(const blink::WebNode& node, 182 bool FindLoginInfo(const blink::WebNode& node,
176 blink::WebInputElement* found_input, 183 blink::WebInputElement* found_input,
177 PasswordInfo* found_password); 184 PasswordInfo* found_password);
178 185
186 // Clears previewed username and password.
Ilya Sherman 2014/05/14 23:10:58 nit: "Clears the preview for the username and pass
ziran.sun 2014/05/15 12:36:37 Done.
187 bool ClearPreview(blink::WebInputElement* username,
188 blink::WebInputElement* password);
189
179 // If |provisionally_saved_forms_| contains a form for |current_frame| or its 190 // If |provisionally_saved_forms_| contains a form for |current_frame| or its
180 // children, return such frame. 191 // children, return such frame.
181 blink::WebFrame* CurrentOrChildFrameWithSavedForms( 192 blink::WebFrame* CurrentOrChildFrameWithSavedForms(
182 const blink::WebFrame* current_frame); 193 const blink::WebFrame* current_frame);
183 194
184 // The logins we have filled so far with their associated info. 195 // The logins we have filled so far with their associated info.
185 LoginToPasswordInfoMap login_to_password_info_; 196 LoginToPasswordInfoMap login_to_password_info_;
186 197
187 // Used for UMA stats. 198 // Used for UMA stats.
188 OtherPossibleUsernamesUsage usernames_usage_; 199 OtherPossibleUsernamesUsage usernames_usage_;
189 200
190 // Pointer to the WebView. Used to access page scale factor. 201 // Pointer to the WebView. Used to access page scale factor.
191 blink::WebView* web_view_; 202 blink::WebView* web_view_;
192 203
193 // Set if the user might be submitting a password form on the current page, 204 // Set if the user might be submitting a password form on the current page,
194 // but the submit may still fail (i.e. doesn't pass JavaScript validation). 205 // but the submit may still fail (i.e. doesn't pass JavaScript validation).
195 FrameToPasswordFormMap provisionally_saved_forms_; 206 FrameToPasswordFormMap provisionally_saved_forms_;
196 207
197 PasswordValueGatekeeper gatekeeper_; 208 PasswordValueGatekeeper gatekeeper_;
198 209
199 // True indicates that user debug information should be logged. 210 // True indicates that user debug information should be logged.
200 bool logging_state_active_; 211 bool logging_state_active_;
201 212
213 // True indicates that the username field was autofilled, false otherwise.
214 bool was_username_autofilled_;
215 // True indicates that the password field was autofilled, false otherwise.
216 bool was_password_autofilled_;
217
202 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; 218 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_;
203 219
204 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); 220 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent);
205 }; 221 };
206 222
207 } // namespace autofill 223 } // namespace autofill
208 224
209 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ 225 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698