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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; | 100 typedef std::map<blink::WebElement, PasswordInfo> LoginToPasswordInfoMap; |
| 101 typedef std::map<blink::WebElement, int> LoginToPasswordInfoKeyMap; |
101 typedef std::map<blink::WebElement, blink::WebElement> PasswordToLoginMap; | 102 typedef std::map<blink::WebElement, blink::WebElement> PasswordToLoginMap; |
102 typedef std::map<blink::WebFrame*, | 103 typedef std::map<blink::WebFrame*, |
103 linked_ptr<PasswordForm> > FrameToPasswordFormMap; | 104 linked_ptr<PasswordForm> > FrameToPasswordFormMap; |
104 | 105 |
105 // This class keeps track of autofilled password input elements and makes sure | 106 // This class keeps track of autofilled password input elements and makes sure |
106 // the autofilled password value is not accessible to JavaScript code until | 107 // the autofilled password value is not accessible to JavaScript code until |
107 // the user interacts with the page. | 108 // the user interacts with the page. |
108 class PasswordValueGatekeeper { | 109 class PasswordValueGatekeeper { |
109 public: | 110 public: |
110 PasswordValueGatekeeper(); | 111 PasswordValueGatekeeper(); |
(...skipping 28 matching lines...) Expand all Loading... |
139 void DidFinishLoad(blink::WebLocalFrame* frame) override; | 140 void DidFinishLoad(blink::WebLocalFrame* frame) override; |
140 void DidStopLoading() override; | 141 void DidStopLoading() override; |
141 void FrameDetached(blink::WebFrame* frame) override; | 142 void FrameDetached(blink::WebFrame* frame) override; |
142 void FrameWillClose(blink::WebFrame* frame) override; | 143 void FrameWillClose(blink::WebFrame* frame) override; |
143 void WillSendSubmitEvent(blink::WebLocalFrame* frame, | 144 void WillSendSubmitEvent(blink::WebLocalFrame* frame, |
144 const blink::WebFormElement& form) override; | 145 const blink::WebFormElement& form) override; |
145 void WillSubmitForm(blink::WebLocalFrame* frame, | 146 void WillSubmitForm(blink::WebLocalFrame* frame, |
146 const blink::WebFormElement& form) override; | 147 const blink::WebFormElement& form) override; |
147 | 148 |
148 // RenderView IPC handlers: | 149 // RenderView IPC handlers: |
149 void OnFillPasswordForm(const PasswordFormFillData& form_data); | 150 void OnFillPasswordForm(int key, const PasswordFormFillData& form_data); |
150 void OnSetLoggingState(bool active); | 151 void OnSetLoggingState(bool active); |
151 | 152 |
152 // Scans the given frame for password forms and sends them up to the browser. | 153 // Scans the given frame for password forms and sends them up to the browser. |
153 // If |only_visible| is true, only forms visible in the layout are sent. | 154 // If |only_visible| is true, only forms visible in the layout are sent. |
154 void SendPasswordForms(blink::WebFrame* frame, bool only_visible); | 155 void SendPasswordForms(blink::WebFrame* frame, bool only_visible); |
155 | 156 |
156 bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, | 157 bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, |
157 const blink::WebInputElement& user_input, | 158 const blink::WebInputElement& user_input, |
158 bool show_all); | 159 bool show_all); |
159 | 160 |
(...skipping 24 matching lines...) Expand all Loading... |
184 const blink::WebFrame* current_frame); | 185 const blink::WebFrame* current_frame); |
185 | 186 |
186 // Extracts a PasswordForm from |form| and saves it as | 187 // Extracts a PasswordForm from |form| and saves it as |
187 // |provisionally_saved_forms_[frame]|, as long as it satisfies |restriction|. | 188 // |provisionally_saved_forms_[frame]|, as long as it satisfies |restriction|. |
188 void ProvisionallySavePassword(blink::WebLocalFrame* frame, | 189 void ProvisionallySavePassword(blink::WebLocalFrame* frame, |
189 const blink::WebFormElement& form, | 190 const blink::WebFormElement& form, |
190 ProvisionallySaveRestriction restriction); | 191 ProvisionallySaveRestriction restriction); |
191 | 192 |
192 // The logins we have filled so far with their associated info. | 193 // The logins we have filled so far with their associated info. |
193 LoginToPasswordInfoMap login_to_password_info_; | 194 LoginToPasswordInfoMap login_to_password_info_; |
| 195 // And the keys under which PasswordAutofillManager can find the same info. |
| 196 LoginToPasswordInfoKeyMap login_to_password_info_key_; |
194 // A (sort-of) reverse map to |login_to_password_info_|. | 197 // A (sort-of) reverse map to |login_to_password_info_|. |
195 PasswordToLoginMap password_to_username_; | 198 PasswordToLoginMap password_to_username_; |
196 | 199 |
197 // Used for UMA stats. | 200 // Used for UMA stats. |
198 OtherPossibleUsernamesUsage usernames_usage_; | 201 OtherPossibleUsernamesUsage usernames_usage_; |
199 | 202 |
200 // Pointer to the WebView. Used to access page scale factor. | 203 // Pointer to the WebView. Used to access page scale factor. |
201 blink::WebView* web_view_; | 204 blink::WebView* web_view_; |
202 | 205 |
203 // Set if the user might be submitting a password form on the current page, | 206 // Set if the user might be submitting a password form on the current page, |
(...skipping 18 matching lines...) Expand all Loading... |
222 bool did_stop_loading_; | 225 bool did_stop_loading_; |
223 | 226 |
224 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 227 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
225 | 228 |
226 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 229 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
227 }; | 230 }; |
228 | 231 |
229 } // namespace autofill | 232 } // namespace autofill |
230 | 233 |
231 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 234 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
OLD | NEW |