| 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 #include "components/autofill/content/renderer/password_autofill_agent.h" | 5 #include "components/autofill/content/renderer/password_autofill_agent.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 | 879 |
| 880 // Chrome should never show more than one account for a password element since | 880 // Chrome should never show more than one account for a password element since |
| 881 // this implies that the username element cannot be modified. Thus even if | 881 // this implies that the username element cannot be modified. Thus even if |
| 882 // |show_all| is true, check if the element in question is a password element | 882 // |show_all| is true, check if the element in question is a password element |
| 883 // for the call to ShowSuggestionPopup. | 883 // for the call to ShowSuggestionPopup. |
| 884 return ShowSuggestionPopup(*password_info, element, | 884 return ShowSuggestionPopup(*password_info, element, |
| 885 show_all && !element.isPasswordField(), | 885 show_all && !element.isPasswordField(), |
| 886 element.isPasswordField()); | 886 element.isPasswordField()); |
| 887 } | 887 } |
| 888 | 888 |
| 889 void PasswordAutofillAgent::ShowNotSecureWarning( |
| 890 const blink::WebInputElement& element) { |
| 891 FormData form; |
| 892 FormFieldData field; |
| 893 form_util::FindFormAndFieldForFormControlElement(element, &form, &field); |
| 894 GetPasswordManagerDriver()->ShowNotSecureWarning( |
| 895 field.text_direction, |
| 896 render_frame()->GetRenderView()->ElementBoundsInWindow(element)); |
| 897 } |
| 898 |
| 889 bool PasswordAutofillAgent::OriginCanAccessPasswordManager( | 899 bool PasswordAutofillAgent::OriginCanAccessPasswordManager( |
| 890 const blink::WebSecurityOrigin& origin) { | 900 const blink::WebSecurityOrigin& origin) { |
| 891 return origin.canAccessPasswordManager(); | 901 return origin.canAccessPasswordManager(); |
| 892 } | 902 } |
| 893 | 903 |
| 894 void PasswordAutofillAgent::OnDynamicFormsSeen() { | 904 void PasswordAutofillAgent::OnDynamicFormsSeen() { |
| 895 SendPasswordForms(false /* only_visible */); | 905 SendPasswordForms(false /* only_visible */); |
| 896 } | 906 } |
| 897 | 907 |
| 898 void PasswordAutofillAgent::AJAXSucceeded() { | 908 void PasswordAutofillAgent::AJAXSucceeded() { |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 if (form_data.wait_for_username) | 1252 if (form_data.wait_for_username) |
| 1243 return; | 1253 return; |
| 1244 | 1254 |
| 1245 for (auto element : elements) { | 1255 for (auto element : elements) { |
| 1246 blink::WebInputElement username_element = | 1256 blink::WebInputElement username_element = |
| 1247 !element.isPasswordField() ? element : password_to_username_[element]; | 1257 !element.isPasswordField() ? element : password_to_username_[element]; |
| 1248 blink::WebInputElement password_element = | 1258 blink::WebInputElement password_element = |
| 1249 element.isPasswordField() | 1259 element.isPasswordField() |
| 1250 ? element | 1260 ? element |
| 1251 : web_input_to_password_info_[element].password_field; | 1261 : web_input_to_password_info_[element].password_field; |
| 1252 FillFormOnPasswordReceived( | 1262 if (FillFormOnPasswordReceived( |
| 1253 form_data, username_element, password_element, | 1263 form_data, username_element, password_element, |
| 1254 &field_value_and_properties_map_, | 1264 &field_value_and_properties_map_, |
| 1255 base::Bind(&PasswordValueGatekeeper::RegisterElement, | 1265 base::Bind(&PasswordValueGatekeeper::RegisterElement, |
| 1256 base::Unretained(&gatekeeper_)), | 1266 base::Unretained(&gatekeeper_)), |
| 1257 logger.get()); | 1267 logger.get())) { |
| 1268 if (form_data.show_form_not_secure_warning_on_autofill) |
| 1269 autofill_agent_->ShowNotSecureWarning(username_element); |
| 1270 } |
| 1258 } | 1271 } |
| 1259 } | 1272 } |
| 1260 | 1273 |
| 1261 void PasswordAutofillAgent::GetFillableElementFromFormData( | 1274 void PasswordAutofillAgent::GetFillableElementFromFormData( |
| 1262 int key, | 1275 int key, |
| 1263 const PasswordFormFillData& form_data, | 1276 const PasswordFormFillData& form_data, |
| 1264 RendererSavePasswordProgressLogger* logger, | 1277 RendererSavePasswordProgressLogger* logger, |
| 1265 std::vector<blink::WebInputElement>* elements) { | 1278 std::vector<blink::WebInputElement>* elements) { |
| 1266 DCHECK(elements); | 1279 DCHECK(elements); |
| 1267 bool ambiguous_or_empty_names = | 1280 bool ambiguous_or_empty_names = |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1489 PasswordAutofillAgent::GetPasswordManagerDriver() { | 1502 PasswordAutofillAgent::GetPasswordManagerDriver() { |
| 1490 if (!password_manager_driver_) { | 1503 if (!password_manager_driver_) { |
| 1491 render_frame()->GetRemoteInterfaces()->GetInterface( | 1504 render_frame()->GetRemoteInterfaces()->GetInterface( |
| 1492 mojo::MakeRequest(&password_manager_driver_)); | 1505 mojo::MakeRequest(&password_manager_driver_)); |
| 1493 } | 1506 } |
| 1494 | 1507 |
| 1495 return password_manager_driver_; | 1508 return password_manager_driver_; |
| 1496 } | 1509 } |
| 1497 | 1510 |
| 1498 } // namespace autofill | 1511 } // namespace autofill |
| OLD | NEW |