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 PasswordInfo() : backspace_pressed_last(false) {} | 103 PasswordInfo() : backspace_pressed_last(false) {} |
98 }; | 104 }; |
99 typedef std::map<blink::WebElement, PasswordInfo> LoginToPasswordInfoMap; | 105 typedef std::map<blink::WebElement, PasswordInfo> LoginToPasswordInfoMap; |
100 typedef std::map<blink::WebFrame*, | 106 typedef std::map<blink::WebFrame*, |
101 linked_ptr<PasswordForm> > FrameToPasswordFormMap; | 107 linked_ptr<PasswordForm> > FrameToPasswordFormMap; |
102 | 108 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 169 |
164 // Attempts to fill |username_element| and |password_element| with the | 170 // Attempts to fill |username_element| and |password_element| with the |
165 // |fill_data|. Will use the data corresponding to the preferred username, | 171 // |fill_data|. Will use the data corresponding to the preferred username, |
166 // unless the |username_element| already has a value set. In that case, | 172 // unless the |username_element| already has a value set. In that case, |
167 // attempts to fill the password matching the already filled username, if | 173 // attempts to fill the password matching the already filled username, if |
168 // such a password exists. | 174 // such a password exists. |
169 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data, | 175 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data, |
170 blink::WebInputElement username_element, | 176 blink::WebInputElement username_element, |
171 blink::WebInputElement password_element); | 177 blink::WebInputElement password_element); |
172 | 178 |
| 179 // options_mask should be a bitwise mask of FillUserNameAndPasswordOptions |
| 180 // values. |
173 bool FillUserNameAndPassword(blink::WebInputElement* username_element, | 181 bool FillUserNameAndPassword(blink::WebInputElement* username_element, |
174 blink::WebInputElement* password_element, | 182 blink::WebInputElement* password_element, |
175 const PasswordFormFillData& fill_data, | 183 const PasswordFormFillData& fill_data, |
176 bool exact_username_match, | 184 const int options_mask); |
177 bool set_selection); | |
178 | 185 |
179 // Fills |login_input| and |password| with the most relevant suggestion from | 186 // Fills |login_input| and |password| with the most relevant suggestion from |
180 // |fill_data| and shows a popup with other suggestions. | 187 // |fill_data| and shows a popup with other suggestions. |
181 void PerformInlineAutocomplete( | 188 void PerformInlineAutocomplete( |
182 const blink::WebInputElement& username, | 189 const blink::WebInputElement& username, |
183 const blink::WebInputElement& password, | 190 const blink::WebInputElement& password, |
184 const PasswordFormFillData& fill_data); | 191 const PasswordFormFillData& fill_data); |
185 | 192 |
186 // Invoked when the passed frame is closing. Gives us a chance to clear any | 193 // Invoked when the passed frame is closing. Gives us a chance to clear any |
187 // reference we may have to elements in that frame. | 194 // reference we may have to elements in that frame. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 bool did_stop_loading_; | 246 bool did_stop_loading_; |
240 | 247 |
241 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 248 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
242 | 249 |
243 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 250 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
244 }; | 251 }; |
245 | 252 |
246 } // namespace autofill | 253 } // namespace autofill |
247 | 254 |
248 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 255 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
OLD | NEW |