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 #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 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1425 PasswordInfo password_info; | 1425 PasswordInfo password_info; |
| 1426 password_info.fill_data = form_data; | 1426 password_info.fill_data = form_data; |
| 1427 password_info.key = key; | 1427 password_info.key = key; |
| 1428 password_info.password_field = password_element; | 1428 password_info.password_field = password_element; |
| 1429 web_input_to_password_info_[main_element] = password_info; | 1429 web_input_to_password_info_[main_element] = password_info; |
| 1430 if (!main_element.isPasswordField()) | 1430 if (!main_element.isPasswordField()) |
| 1431 password_to_username_[password_element] = username_element; | 1431 password_to_username_[password_element] = username_element; |
| 1432 if (elements) | 1432 if (elements) |
| 1433 elements->push_back(main_element); | 1433 elements->push_back(main_element); |
| 1434 } | 1434 } |
| 1435 | |
| 1436 // This is a fallback, if for some reasons elements for filling were not found | |
| 1437 // (for example because they were renamed by JavaScript) then add fill data | |
| 1438 // for |web_input_to_password_info_| in order to be able propose filling of | |
| 1439 // password fields on click. | |
| 1440 if (web_input_to_password_info_.empty()) { | |
| 1441 PasswordInfo password_info; | |
| 1442 password_info.fill_data = form_data; | |
| 1443 password_info.key = key; | |
| 1444 web_input_to_password_info_[blink::WebInputElement()] = password_info; | |
|
vabr (Chromium)
2017/02/24 20:10:36
Could you explain in a code comment, how the |pass
dvadym
2017/02/27 10:14:29
Yeah, your explanation is correct, I've updated th
| |
| 1445 } | |
| 1435 } | 1446 } |
| 1436 | 1447 |
| 1437 void PasswordAutofillAgent::FocusedNodeHasChanged(const blink::WebNode& node) { | 1448 void PasswordAutofillAgent::FocusedNodeHasChanged(const blink::WebNode& node) { |
| 1438 if (node.isNull() || !node.isElementNode()) | 1449 if (node.isNull() || !node.isElementNode()) |
| 1439 return; | 1450 return; |
| 1440 const blink::WebElement web_element = node.toConst<blink::WebElement>(); | 1451 const blink::WebElement web_element = node.toConst<blink::WebElement>(); |
| 1441 if (!web_element.isFormControlElement()) | 1452 if (!web_element.isFormControlElement()) |
| 1442 return; | 1453 return; |
| 1443 const blink::WebFormControlElement control_element = | 1454 const blink::WebFormControlElement control_element = |
| 1444 web_element.toConst<blink::WebFormControlElement>(); | 1455 web_element.toConst<blink::WebFormControlElement>(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1585 PasswordAutofillAgent::GetPasswordManagerDriver() { | 1596 PasswordAutofillAgent::GetPasswordManagerDriver() { |
| 1586 if (!password_manager_driver_) { | 1597 if (!password_manager_driver_) { |
| 1587 render_frame()->GetRemoteInterfaces()->GetInterface( | 1598 render_frame()->GetRemoteInterfaces()->GetInterface( |
| 1588 mojo::MakeRequest(&password_manager_driver_)); | 1599 mojo::MakeRequest(&password_manager_driver_)); |
| 1589 } | 1600 } |
| 1590 | 1601 |
| 1591 return password_manager_driver_; | 1602 return password_manager_driver_; |
| 1592 } | 1603 } |
| 1593 | 1604 |
| 1594 } // namespace autofill | 1605 } // namespace autofill |
| OLD | NEW |