| OLD | NEW |
| (Empty) |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/common/password_form_fill_data.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "chrome/common/form_field_data.h" | |
| 9 | |
| 10 PasswordFormFillData::PasswordFormFillData() : wait_for_username(false) { | |
| 11 } | |
| 12 | |
| 13 PasswordFormFillData::~PasswordFormFillData() { | |
| 14 } | |
| 15 | |
| 16 void InitPasswordFormFillData( | |
| 17 const content::PasswordForm& form_on_page, | |
| 18 const content::PasswordFormMap& matches, | |
| 19 const content::PasswordForm* const preferred_match, | |
| 20 bool wait_for_username_before_autofill, | |
| 21 PasswordFormFillData* result) { | |
| 22 // Note that many of the |FormFieldData| members are not initialized for | |
| 23 // |username_field| and |password_field| because they are currently not used | |
| 24 // by the password autocomplete code. | |
| 25 FormFieldData username_field; | |
| 26 username_field.name = form_on_page.username_element; | |
| 27 username_field.value = preferred_match->username_value; | |
| 28 FormFieldData password_field; | |
| 29 password_field.name = form_on_page.password_element; | |
| 30 password_field.value = preferred_match->password_value; | |
| 31 | |
| 32 // Fill basic form data. | |
| 33 result->basic_data.origin = form_on_page.origin; | |
| 34 result->basic_data.action = form_on_page.action; | |
| 35 result->basic_data.fields.push_back(username_field); | |
| 36 result->basic_data.fields.push_back(password_field); | |
| 37 result->wait_for_username = wait_for_username_before_autofill; | |
| 38 | |
| 39 // Copy additional username/value pairs. | |
| 40 content::PasswordFormMap::const_iterator iter; | |
| 41 for (iter = matches.begin(); iter != matches.end(); iter++) { | |
| 42 if (iter->second != preferred_match) | |
| 43 result->additional_logins[iter->first] = iter->second->password_value; | |
| 44 } | |
| 45 } | |
| OLD | NEW |