Chromium Code Reviews| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 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 AcceptSuggestion(const blink::WebNode& node, |
| 44 const blink::WebString& username, | 44 const blink::WebString& username, |
| 45 const blink::WebString& password); | 45 const blink::WebString& password); |
| 46 | 46 |
| 47 // Previews the username and password fields of this form with the given | |
| 48 // values. Returns true if the fields were previewed, false otherwise. | |
| 49 bool SelectSuggestion(const blink::WebNode& node, | |
|
Ilya Sherman
2014/05/13 00:44:05
nit: Let's name this "PreviewSuggestion".
ziran.sun
2014/05/14 15:35:12
Done.
| |
| 50 const blink::WebString& username, | |
| 51 const blink::WebString& password); | |
| 52 | |
| 47 // A no-op. Password forms are not previewed, so they do not need to be | 53 // 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 | 54 // cleared when the selection changes. However, this method returns |
| 49 // true when |node| is fillable by password Autofill. | 55 // true when |node| is fillable by password Autofill. |
| 50 bool DidClearAutofillSelection(const blink::WebNode& node); | 56 bool DidClearAutofillSelection(const blink::WebNode& node); |
| 51 // Shows an Autofill popup with username suggestions for |element|. | 57 // Shows an Autofill popup with username suggestions for |element|. |
| 52 // Returns true if any suggestions were shown, false otherwise. | 58 // Returns true if any suggestions were shown, false otherwise. |
| 53 bool ShowSuggestions(const blink::WebInputElement& element); | 59 bool ShowSuggestions(const blink::WebInputElement& element); |
| 54 | 60 |
| 61 // Return true if password was autofilled before previewing the form. | |
| 62 bool WasPasswordAutofilled(); | |
|
Ilya Sherman
2014/05/13 00:44:05
This shouldn't need to be a public method. It sho
ziran.sun
2014/05/14 15:35:12
Done.
| |
| 63 | |
| 55 // Called when new form controls are inserted. | 64 // Called when new form controls are inserted. |
| 56 void OnDynamicFormsSeen(blink::WebFrame* frame); | 65 void OnDynamicFormsSeen(blink::WebFrame* frame); |
| 57 | 66 |
| 58 // Called when the user first interacts with the page after a load. This is a | 67 // 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 | 68 // signal to make autofilled values of password input elements accessible to |
| 60 // JavaScript. | 69 // JavaScript. |
| 61 void FirstUserGestureObserved(); | 70 void FirstUserGestureObserved(); |
| 62 | 71 |
| 63 protected: | 72 protected: |
| 64 virtual bool OriginCanAccessPasswordManager( | 73 virtual bool OriginCanAccessPasswordManager( |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 | 155 |
| 147 // Attempts to fill |username_element| and |password_element| with the | 156 // Attempts to fill |username_element| and |password_element| with the |
| 148 // |fill_data|. Will use the data corresponding to the preferred username, | 157 // |fill_data|. Will use the data corresponding to the preferred username, |
| 149 // unless the |username_element| already has a value set. In that case, | 158 // unless the |username_element| already has a value set. In that case, |
| 150 // attempts to fill the password matching the already filled username, if | 159 // attempts to fill the password matching the already filled username, if |
| 151 // such a password exists. | 160 // such a password exists. |
| 152 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data, | 161 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data, |
| 153 blink::WebInputElement username_element, | 162 blink::WebInputElement username_element, |
| 154 blink::WebInputElement password_element); | 163 blink::WebInputElement password_element); |
| 155 | 164 |
| 156 bool FillUserNameAndPassword( | 165 bool FillUserNameAndPassword(blink::WebInputElement* username_element, |
| 157 blink::WebInputElement* username_element, | 166 blink::WebInputElement* password_element, |
| 158 blink::WebInputElement* password_element, | 167 const PasswordFormFillData& fill_data, |
| 159 const PasswordFormFillData& fill_data, | 168 bool exact_username_match, |
| 160 bool exact_username_match, | 169 bool set_selection); |
| 161 bool set_selection); | |
| 162 | 170 |
| 163 // Fills |login_input| and |password| with the most relevant suggestion from | 171 // Fills |login_input| and |password| with the most relevant suggestion from |
| 164 // |fill_data| and shows a popup with other suggestions. | 172 // |fill_data| and shows a popup with other suggestions. |
| 165 void PerformInlineAutocomplete( | 173 void PerformInlineAutocomplete( |
| 166 const blink::WebInputElement& username, | 174 const blink::WebInputElement& username, |
| 167 const blink::WebInputElement& password, | 175 const blink::WebInputElement& password, |
| 168 const PasswordFormFillData& fill_data); | 176 const PasswordFormFillData& fill_data); |
| 169 | 177 |
| 170 // Invoked when the passed frame is closing. Gives us a chance to clear any | 178 // Invoked when the passed frame is closing. Gives us a chance to clear any |
| 171 // reference we may have to elements in that frame. | 179 // reference we may have to elements in that frame. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 192 | 200 |
| 193 // Set if the user might be submitting a password form on the current page, | 201 // 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). | 202 // but the submit may still fail (i.e. doesn't pass JavaScript validation). |
| 195 FrameToPasswordFormMap provisionally_saved_forms_; | 203 FrameToPasswordFormMap provisionally_saved_forms_; |
| 196 | 204 |
| 197 PasswordValueGatekeeper gatekeeper_; | 205 PasswordValueGatekeeper gatekeeper_; |
| 198 | 206 |
| 199 // True indicates that user debug information should be logged. | 207 // True indicates that user debug information should be logged. |
| 200 bool logging_state_active_; | 208 bool logging_state_active_; |
| 201 | 209 |
| 210 // True indicates that the password field was autofilled, false otherwise. | |
| 211 bool was_password_autofilled_; | |
| 212 | |
| 213 // True indicates that the password field is previewed. | |
| 214 bool is_password_previewed_; | |
|
Ilya Sherman
2014/05/13 00:44:05
Why is this field necessary?
ziran.sun
2014/05/14 15:35:12
Done.
| |
| 215 | |
| 202 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 216 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
| 203 | 217 |
| 204 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 218 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
| 205 }; | 219 }; |
| 206 | 220 |
| 207 } // namespace autofill | 221 } // namespace autofill |
| 208 | 222 |
| 209 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 223 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
| OLD | NEW |