| 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 20 matching lines...) Expand all Loading... |
| 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 DidSelectSuggestion(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 DidAcceptSuggestion(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 previewing the form. |
| 58 bool WasPasswordAutofilled(); |
| 59 // Return true if password is previewed. |
| 60 bool IsPasswordPreviewed(); |
| 52 | 61 |
| 53 // Called when new form controls are inserted. | 62 // Called when new form controls are inserted. |
| 54 void OnDynamicFormsSeen(blink::WebFrame* frame); | 63 void OnDynamicFormsSeen(blink::WebFrame* frame); |
| 55 | 64 |
| 56 protected: | 65 protected: |
| 57 virtual bool OriginCanAccessPasswordManager( | 66 virtual bool OriginCanAccessPasswordManager( |
| 58 const blink::WebSecurityOrigin& origin); | 67 const blink::WebSecurityOrigin& origin); |
| 59 | 68 |
| 60 private: | 69 private: |
| 61 friend class PasswordAutofillAgentTest; | 70 friend class PasswordAutofillAgentTest; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 148 |
| 140 // Attempts to fill |username_element| and |password_element| with the | 149 // Attempts to fill |username_element| and |password_element| with the |
| 141 // |fill_data|. Will use the data corresponding to the preferred username, | 150 // |fill_data|. Will use the data corresponding to the preferred username, |
| 142 // unless the |username_element| already has a value set. In that case, | 151 // unless the |username_element| already has a value set. In that case, |
| 143 // attempts to fill the password matching the already filled username, if | 152 // attempts to fill the password matching the already filled username, if |
| 144 // such a password exists. | 153 // such a password exists. |
| 145 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data, | 154 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data, |
| 146 blink::WebInputElement username_element, | 155 blink::WebInputElement username_element, |
| 147 blink::WebInputElement password_element); | 156 blink::WebInputElement password_element); |
| 148 | 157 |
| 149 bool FillUserNameAndPassword( | 158 void FindUserNameAndPassword(base::string16 current_username, |
| 159 base::string16* username, |
| 160 base::string16* password, |
| 161 const PasswordFormFillData& fill_data, |
| 162 bool exact_username_match); |
| 163 |
| 164 bool FillUserNameAndPassword(blink::WebInputElement* username_element, |
| 165 blink::WebInputElement* password_element, |
| 166 const PasswordFormFillData& fill_data, |
| 167 bool exact_username_match, |
| 168 bool set_selection); |
| 169 |
| 170 bool PreviewUserNameAndPassword( |
| 150 blink::WebInputElement* username_element, | 171 blink::WebInputElement* username_element, |
| 151 blink::WebInputElement* password_element, | 172 blink::WebInputElement* password_element, |
| 152 const PasswordFormFillData& fill_data, | 173 const PasswordFormFillData& fill_data, |
| 153 bool exact_username_match, | 174 bool exact_username_match, |
| 154 bool set_selection); | 175 bool set_selection); |
| 155 | 176 |
| 156 // Fills |login_input| and |password| with the most relevant suggestion from | 177 // Fills |login_input| and |password| with the most relevant suggestion from |
| 157 // |fill_data| and shows a popup with other suggestions. | 178 // |fill_data| and shows a popup with other suggestions. |
| 158 void PerformInlineAutocomplete( | 179 void PerformInlineAutocomplete( |
| 159 const blink::WebInputElement& username, | 180 const blink::WebInputElement& username, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 182 | 203 |
| 183 // Pointer to the WebView. Used to access page scale factor. | 204 // Pointer to the WebView. Used to access page scale factor. |
| 184 blink::WebView* web_view_; | 205 blink::WebView* web_view_; |
| 185 | 206 |
| 186 // Set if the user might be submitting a password form on the current page, | 207 // 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). | 208 // but the submit may still fail (i.e. doesn't pass JavaScript validation). |
| 188 FrameToPasswordFormMap provisionally_saved_forms_; | 209 FrameToPasswordFormMap provisionally_saved_forms_; |
| 189 | 210 |
| 190 PasswordValueGatekeeper gatekeeper_; | 211 PasswordValueGatekeeper gatekeeper_; |
| 191 | 212 |
| 213 bool was_password_autofilled_; |
| 214 bool is_password_previewed_; |
| 215 |
| 192 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 216 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
| 193 | 217 |
| 194 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 218 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
| 195 }; | 219 }; |
| 196 | 220 |
| 197 } // namespace autofill | 221 } // namespace autofill |
| 198 | 222 |
| 199 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 223 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
| OLD | NEW |