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

Unified Diff: webkit/forms/password_form_dom_manager.cc

Issue 9625026: Save password without an associated username. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Refine the unit_test codes Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: webkit/forms/password_form_dom_manager.cc
===================================================================
--- webkit/forms/password_form_dom_manager.cc (revision 133421)
+++ webkit/forms/password_form_dom_manager.cc (working copy)
@@ -37,23 +37,29 @@
const PasswordForm* const preferred_match,
bool wait_for_username_before_autofill,
PasswordFormFillData* result) {
+
+ // Fill basic form data.
+ result->basic_data.origin = form_on_page.origin;
+ result->basic_data.action = form_on_page.action;
+ result->wait_for_username = wait_for_username_before_autofill;
+
// Note that many of the |FormField| members are not initialized for
// |username_field| and |password_field| because they are currently not used
// by the password autocomplete code.
- FormField username_field;
- username_field.name = form_on_page.username_element;
- username_field.value = preferred_match->username_value;
FormField password_field;
password_field.name = form_on_page.password_element;
password_field.value = preferred_match->password_value;
-
- // Fill basic form data.
- result->basic_data.origin = form_on_page.origin;
- result->basic_data.action = form_on_page.action;
- result->basic_data.fields.push_back(username_field);
result->basic_data.fields.push_back(password_field);
- result->wait_for_username = wait_for_username_before_autofill;
+ // If username_element is empty string,
+ // we suppose that there isn't any username field and don't set the username.
+ if (!form_on_page.username_element.empty()) {
+ FormField username_field;
+ username_field.name = form_on_page.username_element;
+ username_field.value = preferred_match->username_value;
+ result->basic_data.fields.push_back(username_field);
+ }
+
// Copy additional username/value pairs.
PasswordFormMap::const_iterator iter;
for (iter = matches.begin(); iter != matches.end(); iter++) {

Powered by Google App Engine
This is Rietveld 408576698