Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: components/autofill/content/renderer/password_autofill_agent.cc

Issue 2716873002: More robust fill password fields on click. (Closed)
Patch Set: Update comment Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/renderer/autofill/password_autofill_agent_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_|. When the user clicks on a password
1439 // field which is not a key in |web_input_to_password_info_|, the first
1440 // element from |web_input_to_password_info_| will be used in
1441 // PasswordAutofillAgent::FindPasswordInfoForElement to propose to fill.
1442 if (web_input_to_password_info_.empty()) {
1443 PasswordInfo password_info;
1444 password_info.fill_data = form_data;
1445 password_info.key = key;
1446 web_input_to_password_info_[blink::WebInputElement()] = password_info;
1447 }
1435 } 1448 }
1436 1449
1437 void PasswordAutofillAgent::FocusedNodeHasChanged(const blink::WebNode& node) { 1450 void PasswordAutofillAgent::FocusedNodeHasChanged(const blink::WebNode& node) {
1438 if (node.isNull() || !node.isElementNode()) 1451 if (node.isNull() || !node.isElementNode())
1439 return; 1452 return;
1440 const blink::WebElement web_element = node.toConst<blink::WebElement>(); 1453 const blink::WebElement web_element = node.toConst<blink::WebElement>();
1441 if (!web_element.isFormControlElement()) 1454 if (!web_element.isFormControlElement())
1442 return; 1455 return;
1443 const blink::WebFormControlElement control_element = 1456 const blink::WebFormControlElement control_element =
1444 web_element.toConst<blink::WebFormControlElement>(); 1457 web_element.toConst<blink::WebFormControlElement>();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 PasswordAutofillAgent::GetPasswordManagerDriver() { 1598 PasswordAutofillAgent::GetPasswordManagerDriver() {
1586 if (!password_manager_driver_) { 1599 if (!password_manager_driver_) {
1587 render_frame()->GetRemoteInterfaces()->GetInterface( 1600 render_frame()->GetRemoteInterfaces()->GetInterface(
1588 mojo::MakeRequest(&password_manager_driver_)); 1601 mojo::MakeRequest(&password_manager_driver_));
1589 } 1602 }
1590 1603
1591 return password_manager_driver_; 1604 return password_manager_driver_;
1592 } 1605 }
1593 1606
1594 } // namespace autofill 1607 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/renderer/autofill/password_autofill_agent_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698