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

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: Created 6 years, 9 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 20 matching lines...) Expand all
31 virtual ~PasswordAutofillAgent(); 31 virtual ~PasswordAutofillAgent();
32 32
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 // Preview the password associated with user name |username|. Returns true if
42 // the username and password fields were previewed, false otherwise.
43 bool DidSelectAutofillSuggestion(const blink::WebNode& node,
44 const blink::WebString& username);
45
41 // Fills the password associated with user name |username|. Returns true if 46 // Fills the password associated with user name |username|. Returns true if
42 // the username and password fields were filled, false otherwise. 47 // the username and password fields were filled, false otherwise.
43 bool DidAcceptAutofillSuggestion(const blink::WebNode& node, 48 bool DidAcceptAutofillSuggestion(const blink::WebNode& node,
44 const blink::WebString& username); 49 const blink::WebString& username);
45 // A no-op. Password forms are not previewed, so they do not need to be 50 // A no-op. Password forms are not previewed, so they do not need to be
46 // cleared when the selection changes. However, this method returns 51 // cleared when the selection changes. However, this method returns
47 // true when |node| is fillable by password Autofill. 52 // true when |node| is fillable by password Autofill.
48 bool DidClearAutofillSelection(const blink::WebNode& node); 53 bool DidClearAutofillSelection(const blink::WebNode& node);
49 // Shows an Autofill popup with username suggestions for |element|. 54 // Shows an Autofill popup with username suggestions for |element|.
50 // Returns true if any suggestions were shown, false otherwise. 55 // Returns true if any suggestions were shown, false otherwise.
51 bool ShowSuggestions(const blink::WebInputElement& element); 56 bool ShowSuggestions(const blink::WebInputElement& element);
57 // Return true if password was autofilled before preview the form.
Ilya Sherman 2014/03/21 22:35:19 nit: "before preview" -> "before previewing"
ziran.sun 2014/03/25 18:25:26 Done.
58 bool WasPasswordAutofilled();
52 59
53 // Called when new form controls are inserted. 60 // Called when new form controls are inserted.
54 void OnDynamicFormsSeen(blink::WebFrame* frame); 61 void OnDynamicFormsSeen(blink::WebFrame* frame);
55 62
56 protected: 63 protected:
57 virtual bool OriginCanAccessPasswordManager( 64 virtual bool OriginCanAccessPasswordManager(
58 const blink::WebSecurityOrigin& origin); 65 const blink::WebSecurityOrigin& origin);
59 66
60 private: 67 private:
61 friend class PasswordAutofillAgentTest; 68 friend class PasswordAutofillAgentTest;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 146
140 // Attempts to fill |username_element| and |password_element| with the 147 // Attempts to fill |username_element| and |password_element| with the
141 // |fill_data|. Will use the data corresponding to the preferred username, 148 // |fill_data|. Will use the data corresponding to the preferred username,
142 // unless the |username_element| already has a value set. In that case, 149 // unless the |username_element| already has a value set. In that case,
143 // attempts to fill the password matching the already filled username, if 150 // attempts to fill the password matching the already filled username, if
144 // such a password exists. 151 // such a password exists.
145 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data, 152 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data,
146 blink::WebInputElement username_element, 153 blink::WebInputElement username_element,
147 blink::WebInputElement password_element); 154 blink::WebInputElement password_element);
148 155
156 std::vector<base::string16> FindUserNameAndPassword(
157 base::string16 current_username,
158 const PasswordFormFillData& fill_data,
159 bool exact_username_match);
160
149 bool FillUserNameAndPassword( 161 bool FillUserNameAndPassword(
150 blink::WebInputElement* username_element, 162 blink::WebInputElement* username_element,
151 blink::WebInputElement* password_element, 163 blink::WebInputElement* password_element,
152 const PasswordFormFillData& fill_data, 164 const PasswordFormFillData& fill_data,
153 bool exact_username_match, 165 bool exact_username_match,
154 bool set_selection); 166 bool set_selection);
155 167
168 bool PreviewUserNameAndPassword(
169 blink::WebInputElement* username_element,
170 blink::WebInputElement* password_element,
171 const PasswordFormFillData& fill_data,
172 bool exact_username_match,
173 bool set_selection);
174
156 // Fills |login_input| and |password| with the most relevant suggestion from 175 // Fills |login_input| and |password| with the most relevant suggestion from
157 // |fill_data| and shows a popup with other suggestions. 176 // |fill_data| and shows a popup with other suggestions.
158 void PerformInlineAutocomplete( 177 void PerformInlineAutocomplete(
159 const blink::WebInputElement& username, 178 const blink::WebInputElement& username,
160 const blink::WebInputElement& password, 179 const blink::WebInputElement& password,
161 const PasswordFormFillData& fill_data); 180 const PasswordFormFillData& fill_data);
162 181
163 // Invoked when the passed frame is closing. Gives us a chance to clear any 182 // Invoked when the passed frame is closing. Gives us a chance to clear any
164 // reference we may have to elements in that frame. 183 // reference we may have to elements in that frame.
165 void FrameClosing(const blink::WebFrame* frame); 184 void FrameClosing(const blink::WebFrame* frame);
(...skipping 16 matching lines...) Expand all
182 201
183 // Pointer to the WebView. Used to access page scale factor. 202 // Pointer to the WebView. Used to access page scale factor.
184 blink::WebView* web_view_; 203 blink::WebView* web_view_;
185 204
186 // Set if the user might be submitting a password form on the current page, 205 // Set if the user might be submitting a password form on the current page,
187 // but the submit may still fail (i.e. doesn't pass JavaScript validation). 206 // but the submit may still fail (i.e. doesn't pass JavaScript validation).
188 FrameToPasswordFormMap provisionally_saved_forms_; 207 FrameToPasswordFormMap provisionally_saved_forms_;
189 208
190 PasswordValueGatekeeper gatekeeper_; 209 PasswordValueGatekeeper gatekeeper_;
191 210
211 bool was_password_autofilled_;
212
192 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; 213 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_;
193 214
194 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); 215 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent);
195 }; 216 };
196 217
197 } // namespace autofill 218 } // namespace autofill
198 219
199 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ 220 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698