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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 struct PasswordInfo { | 91 struct PasswordInfo { |
92 blink::WebInputElement password_field; | 92 blink::WebInputElement password_field; |
93 PasswordFormFillData fill_data; | 93 PasswordFormFillData fill_data; |
94 bool backspace_pressed_last; | 94 bool backspace_pressed_last; |
95 // The user manually edited the password more recently than the username was | 95 // The user manually edited the password more recently than the username was |
96 // changed. | 96 // changed. |
97 bool password_was_edited_last; | 97 bool password_was_edited_last; |
98 PasswordInfo(); | 98 PasswordInfo(); |
99 }; | 99 }; |
100 typedef std::map<blink::WebElement, PasswordInfo> LoginToPasswordInfoMap; | |
101 typedef std::map<blink::WebElement, int> LoginToPasswordInfoKeyMap; | 100 typedef std::map<blink::WebElement, int> LoginToPasswordInfoKeyMap; |
102 typedef std::map<blink::WebElement, blink::WebElement> PasswordToLoginMap; | 101 typedef std::map<blink::WebInputElement, PasswordInfo> LoginToPasswordInfoMap; |
| 102 typedef std::map<blink::WebInputElement, blink::WebInputElement> |
| 103 PasswordToLoginMap; |
103 typedef std::map<blink::WebFrame*, | 104 typedef std::map<blink::WebFrame*, |
104 linked_ptr<PasswordForm> > FrameToPasswordFormMap; | 105 linked_ptr<PasswordForm> > FrameToPasswordFormMap; |
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(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // RenderView IPC handlers: | 150 // RenderView IPC handlers: |
150 void OnFillPasswordForm(int key, const PasswordFormFillData& form_data); | 151 void OnFillPasswordForm(int key, const PasswordFormFillData& form_data); |
151 void OnSetLoggingState(bool active); | 152 void OnSetLoggingState(bool active); |
152 | 153 |
153 // Scans the given frame for password forms and sends them up to the browser. | 154 // Scans the given frame for password forms and sends them up to the browser. |
154 // If |only_visible| is true, only forms visible in the layout are sent. | 155 // If |only_visible| is true, only forms visible in the layout are sent. |
155 void SendPasswordForms(blink::WebFrame* frame, bool only_visible); | 156 void SendPasswordForms(blink::WebFrame* frame, bool only_visible); |
156 | 157 |
157 bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, | 158 bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, |
158 const blink::WebInputElement& user_input, | 159 const blink::WebInputElement& user_input, |
159 bool show_all); | 160 bool show_all, |
| 161 bool show_on_password_field); |
| 162 |
| 163 // Finds the PasswordInfo that corresponds to the passed in element. The |
| 164 // passed in element can be either a username element or a password element. |
| 165 LoginToPasswordInfoMap::iterator FindPasswordInfoForElement( |
| 166 const blink::WebInputElement& element); |
160 | 167 |
161 // Fills |login_input| and |password| with the most relevant suggestion from | 168 // Fills |login_input| and |password| with the most relevant suggestion from |
162 // |fill_data| and shows a popup with other suggestions. | 169 // |fill_data| and shows a popup with other suggestions. |
163 void PerformInlineAutocomplete( | 170 void PerformInlineAutocomplete( |
164 const blink::WebInputElement& username, | 171 const blink::WebInputElement& username, |
165 const blink::WebInputElement& password, | 172 const blink::WebInputElement& password, |
166 const PasswordFormFillData& fill_data); | 173 const PasswordFormFillData& fill_data); |
167 | 174 |
168 // Invoked when the passed frame is closing. Gives us a chance to clear any | 175 // Invoked when the passed frame is closing. Gives us a chance to clear any |
169 // reference we may have to elements in that frame. | 176 // reference we may have to elements in that frame. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 bool did_stop_loading_; | 232 bool did_stop_loading_; |
226 | 233 |
227 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 234 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
228 | 235 |
229 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 236 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
230 }; | 237 }; |
231 | 238 |
232 } // namespace autofill | 239 } // namespace autofill |
233 | 240 |
234 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 241 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
OLD | NEW |