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

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

Issue 773823002: PasswordManager should trigger autofill for new forms + old PasswordFromManagers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't duplicate the blacklist & generation IPC Created 6 years 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
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 bool form_contains_username_field = FillDataContainsUsername(form_data); 988 bool form_contains_username_field = FillDataContainsUsername(form_data);
989 if (form_contains_username_field) { 989 if (form_contains_username_field) {
990 username_element = 990 username_element =
991 form_elements->input_elements[form_data.username_field.name]; 991 form_elements->input_elements[form_data.username_field.name];
992 } 992 }
993 993
994 // No password field, bail out. 994 // No password field, bail out.
995 if (form_data.password_field.name.empty()) 995 if (form_data.password_field.name.empty())
996 break; 996 break;
997 997
998 // We might have already filled this form if there are two <form> elements
999 // with identical markup.
1000 if (login_to_password_info_.find(username_element) !=
1001 login_to_password_info_.end())
1002 continue;
1003
998 // Get pointer to password element. (We currently only support single 1004 // Get pointer to password element. (We currently only support single
999 // password forms). 1005 // password forms).
1000 password_element = 1006 password_element =
1001 form_elements->input_elements[form_data.password_field.name]; 1007 form_elements->input_elements[form_data.password_field.name];
1002 1008
1003 // If wait_for_username is true, we don't want to initially fill the form 1009 // If wait_for_username is true, we don't want to initially fill the form
1004 // until the user types in a valid username. 1010 // until the user types in a valid username.
1005 if (!form_data.wait_for_username && 1011 if (!form_data.wait_for_username &&
1006 FillFormOnPasswordRecieved( 1012 FillFormOnPasswordRecieved(
1007 form_data, 1013 form_data,
1008 username_element, 1014 username_element,
1009 password_element, 1015 password_element,
1010 base::Bind(&PasswordValueGatekeeper::RegisterElement, 1016 base::Bind(&PasswordValueGatekeeper::RegisterElement,
1011 base::Unretained(&gatekeeper_)))) { 1017 base::Unretained(&gatekeeper_)))) {
1012 usernames_usage_ = OTHER_POSSIBLE_USERNAME_SELECTED; 1018 usernames_usage_ = OTHER_POSSIBLE_USERNAME_SELECTED;
1013 } 1019 }
1014 // We might have already filled this form if there are two <form> elements
1015 // with identical markup.
1016 if (login_to_password_info_.find(username_element) !=
1017 login_to_password_info_.end())
1018 continue;
1019 1020
1020 PasswordInfo password_info; 1021 PasswordInfo password_info;
1021 password_info.fill_data = form_data; 1022 password_info.fill_data = form_data;
1022 password_info.password_field = password_element; 1023 password_info.password_field = password_element;
1023 login_to_password_info_[username_element] = password_info; 1024 login_to_password_info_[username_element] = password_info;
1024 password_to_username_[password_element] = username_element; 1025 password_to_username_[password_element] = username_element;
1025 login_to_password_info_key_[username_element] = key; 1026 login_to_password_info_key_[username_element] = key;
1026 } 1027 }
1027 } 1028 }
1028 1029
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 agent_->WillSendSubmitEvent(frame, form); 1212 agent_->WillSendSubmitEvent(frame, form);
1212 } 1213 }
1213 1214
1214 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::WillSubmitForm( 1215 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::WillSubmitForm(
1215 blink::WebLocalFrame* frame, 1216 blink::WebLocalFrame* frame,
1216 const blink::WebFormElement& form) { 1217 const blink::WebFormElement& form) {
1217 agent_->WillSubmitForm(frame, form); 1218 agent_->WillSubmitForm(frame, form);
1218 } 1219 }
1219 1220
1220 } // namespace autofill 1221 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/test/data/password/dynamic_password_form.html ('k') | components/password_manager/core/browser/password_form_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698