| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 struct PasswordInfo { | 93 struct PasswordInfo { |
| 94 blink::WebInputElement password_field; | 94 blink::WebInputElement password_field; |
| 95 PasswordFormFillData fill_data; | 95 PasswordFormFillData fill_data; |
| 96 bool backspace_pressed_last; | 96 bool backspace_pressed_last; |
| 97 // The user manually edited the password more recently than the username was | 97 // The user manually edited the password more recently than the username was |
| 98 // changed. | 98 // changed. |
| 99 bool password_was_edited_last; | 99 bool password_was_edited_last; |
| 100 PasswordInfo(); | 100 PasswordInfo(); |
| 101 }; | 101 }; |
| 102 typedef std::map<blink::WebElement, PasswordInfo> LoginToPasswordInfoMap; | 102 typedef std::map<blink::WebInputElement, PasswordInfo> LoginToPasswordInfoMap; |
| 103 typedef std::map<blink::WebElement, int> LoginToPasswordInfoKeyMap; | 103 typedef std::map<blink::WebElement, int> LoginToPasswordInfoKeyMap; |
| 104 typedef std::map<blink::WebElement, blink::WebElement> PasswordToLoginMap; | 104 typedef std::map<blink::WebInputElement, blink::WebInputElement> |
| 105 PasswordToLoginMap; |
| 105 | 106 |
| 106 // This class keeps track of autofilled password input elements and makes sure | 107 // This class keeps track of autofilled password input elements and makes sure |
| 107 // the autofilled password value is not accessible to JavaScript code until | 108 // the autofilled password value is not accessible to JavaScript code until |
| 108 // the user interacts with the page. | 109 // the user interacts with the page. |
| 109 class PasswordValueGatekeeper { | 110 class PasswordValueGatekeeper { |
| 110 public: | 111 public: |
| 111 PasswordValueGatekeeper(); | 112 PasswordValueGatekeeper(); |
| 112 ~PasswordValueGatekeeper(); | 113 ~PasswordValueGatekeeper(); |
| 113 | 114 |
| 114 // Call this for every autofilled password field, so that the gatekeeper | 115 // Call this for every autofilled password field, so that the gatekeeper |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // RenderView IPC handlers: | 188 // RenderView IPC handlers: |
| 188 void OnFillPasswordForm(int key, const PasswordFormFillData& form_data); | 189 void OnFillPasswordForm(int key, const PasswordFormFillData& form_data); |
| 189 void OnSetLoggingState(bool active); | 190 void OnSetLoggingState(bool active); |
| 190 | 191 |
| 191 // Scans the given frame for password forms and sends them up to the browser. | 192 // Scans the given frame for password forms and sends them up to the browser. |
| 192 // If |only_visible| is true, only forms visible in the layout are sent. | 193 // If |only_visible| is true, only forms visible in the layout are sent. |
| 193 void SendPasswordForms(bool only_visible); | 194 void SendPasswordForms(bool only_visible); |
| 194 | 195 |
| 195 bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, | 196 bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, |
| 196 const blink::WebInputElement& user_input, | 197 const blink::WebInputElement& user_input, |
| 197 bool show_all); | 198 bool show_all, |
| 199 bool show_on_password_field); |
| 200 |
| 201 // Finds the PasswordInfo that corresponds to the passed in element. The |
| 202 // passed in element can be either a username element or a password element. |
| 203 // If a PasswordInfo was found, returns |true| and also assigns the |
| 204 // corresponding username WebInputElement and PasswordInfo into |
| 205 // username_element and pasword_info, respectively. |
| 206 bool FindPasswordInfoForElement( |
| 207 const blink::WebInputElement& element, |
| 208 const blink::WebInputElement** username_element, |
| 209 PasswordInfo** password_info); |
| 198 | 210 |
| 199 // Fills |login_input| and |password| with the most relevant suggestion from | 211 // Fills |login_input| and |password| with the most relevant suggestion from |
| 200 // |fill_data| and shows a popup with other suggestions. | 212 // |fill_data| and shows a popup with other suggestions. |
| 201 void PerformInlineAutocomplete( | 213 void PerformInlineAutocomplete( |
| 202 const blink::WebInputElement& username, | 214 const blink::WebInputElement& username, |
| 203 const blink::WebInputElement& password, | 215 const blink::WebInputElement& password, |
| 204 const PasswordFormFillData& fill_data); | 216 const PasswordFormFillData& fill_data); |
| 205 | 217 |
| 206 // Invoked when the frame is closing. | 218 // Invoked when the frame is closing. |
| 207 void FrameClosing(); | 219 void FrameClosing(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 bool did_stop_loading_; | 271 bool did_stop_loading_; |
| 260 | 272 |
| 261 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 273 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
| 262 | 274 |
| 263 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 275 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
| 264 }; | 276 }; |
| 265 | 277 |
| 266 } // namespace autofill | 278 } // namespace autofill |
| 267 | 279 |
| 268 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 280 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
| OLD | NEW |