Chromium Code Reviews| 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; | 100 typedef std::map<blink::WebInputElement, PasswordInfo> LoginToPasswordInfoMap; |
| 101 typedef std::map<blink::WebElement, blink::WebElement> PasswordToLoginMap; | 101 typedef std::map<blink::WebInputElement, blink::WebInputElement> |
| 102 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(); |
| 111 ~PasswordValueGatekeeper(); | 112 ~PasswordValueGatekeeper(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 // RenderView IPC handlers: | 149 // RenderView IPC handlers: |
| 149 void OnFillPasswordForm(const PasswordFormFillData& form_data); | 150 void OnFillPasswordForm(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, |
| 160 bool show_on_password_field = false); | |
|
Garrett Casto
2014/11/04 23:35:30
Default arguments are verboten.
jww
2014/11/06 21:28:57
Done.
| |
| 161 | |
| 162 // Finds the PasswordInfo that corresponds to the passed in element. The | |
| 163 // passed in element can be either a username element or a password element. | |
| 164 LoginToPasswordInfoMap::iterator FindPasswordInfoForElement( | |
| 165 const blink::WebInputElement& element); | |
| 159 | 166 |
| 160 // Fills |login_input| and |password| with the most relevant suggestion from | 167 // Fills |login_input| and |password| with the most relevant suggestion from |
| 161 // |fill_data| and shows a popup with other suggestions. | 168 // |fill_data| and shows a popup with other suggestions. |
| 162 void PerformInlineAutocomplete( | 169 void PerformInlineAutocomplete( |
| 163 const blink::WebInputElement& username, | 170 const blink::WebInputElement& username, |
| 164 const blink::WebInputElement& password, | 171 const blink::WebInputElement& password, |
| 165 const PasswordFormFillData& fill_data); | 172 const PasswordFormFillData& fill_data); |
| 166 | 173 |
| 167 // Invoked when the passed frame is closing. Gives us a chance to clear any | 174 // Invoked when the passed frame is closing. Gives us a chance to clear any |
| 168 // reference we may have to elements in that frame. | 175 // reference we may have to elements in that frame. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 bool did_stop_loading_; | 229 bool did_stop_loading_; |
| 223 | 230 |
| 224 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 231 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
| 225 | 232 |
| 226 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 233 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
| 227 }; | 234 }; |
| 228 | 235 |
| 229 } // namespace autofill | 236 } // namespace autofill |
| 230 | 237 |
| 231 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 238 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
| OLD | NEW |