| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 OTHER_POSSIBLE_USERNAME_SELECTED, | 83 OTHER_POSSIBLE_USERNAME_SELECTED, |
| 84 OTHER_POSSIBLE_USERNAMES_MAX | 84 OTHER_POSSIBLE_USERNAMES_MAX |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 // Ways to restrict which passwords are saved in ProvisionallySavePassword. | 87 // Ways to restrict which passwords are saved in ProvisionallySavePassword. |
| 88 enum ProvisionallySaveRestriction { | 88 enum ProvisionallySaveRestriction { |
| 89 RESTRICTION_NONE, | 89 RESTRICTION_NONE, |
| 90 RESTRICTION_NON_EMPTY_PASSWORD | 90 RESTRICTION_NON_EMPTY_PASSWORD |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 enum FillUserNameAndPasswordOptions { |
| 94 EXACT_USERNAME_MATCH = 1 << 0, |
| 95 SET_SELECTION = 1 << 1, |
| 96 FILL_PREFERRED_USERNAME = 1 << 2 |
| 97 }; |
| 98 |
| 93 struct PasswordInfo { | 99 struct PasswordInfo { |
| 94 blink::WebInputElement password_field; | 100 blink::WebInputElement password_field; |
| 95 PasswordFormFillData fill_data; | 101 PasswordFormFillData fill_data; |
| 96 bool backspace_pressed_last; | 102 bool backspace_pressed_last; |
| 97 // The user manually edited the password more recently than the username was | 103 // The user manually edited the password more recently than the username was |
| 98 // changed. | 104 // changed. |
| 99 bool password_was_edited_last; | 105 bool password_was_edited_last; |
| 100 PasswordInfo(); | 106 PasswordInfo(); |
| 101 }; | 107 }; |
| 102 typedef std::map<blink::WebElement, PasswordInfo> LoginToPasswordInfoMap; | 108 typedef std::map<blink::WebElement, PasswordInfo> LoginToPasswordInfoMap; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 169 |
| 164 bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, | 170 bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, |
| 165 const blink::WebInputElement& user_input, | 171 const blink::WebInputElement& user_input, |
| 166 bool show_all); | 172 bool show_all); |
| 167 | 173 |
| 168 // Attempts to fill |username_element| and |password_element| with the | 174 // Attempts to fill |username_element| and |password_element| with the |
| 169 // |fill_data|. Will use the data corresponding to the preferred username, | 175 // |fill_data|. Will use the data corresponding to the preferred username, |
| 170 // unless the |username_element| already has a value set. In that case, | 176 // unless the |username_element| already has a value set. In that case, |
| 171 // attempts to fill the password matching the already filled username, if | 177 // attempts to fill the password matching the already filled username, if |
| 172 // such a password exists. | 178 // such a password exists. |
| 173 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data, | 179 void FillFormOnPasswordReceived(const PasswordFormFillData& fill_data, |
| 174 blink::WebInputElement username_element, | 180 blink::WebInputElement username_element, |
| 175 blink::WebInputElement password_element); | 181 blink::WebInputElement password_element); |
| 176 | 182 |
| 183 // options_mask should be a bitwise mask of FillUserNameAndPasswordOptions |
| 184 // values. |
| 177 bool FillUserNameAndPassword(blink::WebInputElement* username_element, | 185 bool FillUserNameAndPassword(blink::WebInputElement* username_element, |
| 178 blink::WebInputElement* password_element, | 186 blink::WebInputElement* password_element, |
| 179 const PasswordFormFillData& fill_data, | 187 const PasswordFormFillData& fill_data, |
| 180 bool exact_username_match, | 188 const int options_mask); |
| 181 bool set_selection); | |
| 182 | 189 |
| 183 // Fills |login_input| and |password| with the most relevant suggestion from | 190 // Fills |login_input| and |password| with the most relevant suggestion from |
| 184 // |fill_data| and shows a popup with other suggestions. | 191 // |fill_data| and shows a popup with other suggestions. |
| 185 void PerformInlineAutocomplete( | 192 void PerformInlineAutocomplete( |
| 186 const blink::WebInputElement& username, | 193 const blink::WebInputElement& username, |
| 187 const blink::WebInputElement& password, | 194 const blink::WebInputElement& password, |
| 188 const PasswordFormFillData& fill_data); | 195 const PasswordFormFillData& fill_data); |
| 189 | 196 |
| 190 // Invoked when the passed frame is closing. Gives us a chance to clear any | 197 // Invoked when the passed frame is closing. Gives us a chance to clear any |
| 191 // reference we may have to elements in that frame. | 198 // reference we may have to elements in that frame. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 bool did_stop_loading_; | 252 bool did_stop_loading_; |
| 246 | 253 |
| 247 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 254 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
| 248 | 255 |
| 249 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 256 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
| 250 }; | 257 }; |
| 251 | 258 |
| 252 } // namespace autofill | 259 } // namespace autofill |
| 253 | 260 |
| 254 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 261 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
| OLD | NEW |