From 1ecbe866c38fb6c781d337393b7ff62d0c662f4e Mon Sep 17 00:00:00 2001 From: "blundell@chromium.org" Date: Fri, 5 Oct 2012 01:29:14 +0000 Subject: Move forms/ out of webkit/. The motivation for this CL is to move PasswordForm and friends (which are totally unrelated to WebKit) out of webkit/ and into a target that platforms that do not use WebKit (such as iOS) can logically depend on. As such, this CL does three things: 1. Separates the WebKit-related code in webkit/forms from the non-WebKit-related code. Concretely, this means having the WebKit::WebFormElement->PasswordForm conversion function in its own file. 2. Moves the core, non-WebKit-related forms code to chrome/common and content/public/common depending on where its usage points are. 3. Moves the above-mentioned conversion function to content/public/renderer. It cannot stay in webkit/ as it (now) has a dependency on content/, and as it is used only in chrome/renderer and content/renderer, this is a good place for it. The rest of this CL is churn due to namespace, file location, and GYP target changes. BUG= Review URL: https://chromiumcodereview.appspot.com/11000016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160280 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/password_form_fill_data.cc | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 chrome/common/password_form_fill_data.cc (limited to 'chrome/common/password_form_fill_data.cc') diff --git a/chrome/common/password_form_fill_data.cc b/chrome/common/password_form_fill_data.cc new file mode 100644 index 0000000..c733719 --- /dev/null +++ b/chrome/common/password_form_fill_data.cc @@ -0,0 +1,45 @@ +// Copyright 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/password_form_fill_data.h" + +#include "base/logging.h" +#include "chrome/common/form_field_data.h" + +PasswordFormFillData::PasswordFormFillData() : wait_for_username(false) { +} + +PasswordFormFillData::~PasswordFormFillData() { +} + +void InitPasswordFormFillData( + const content::PasswordForm& form_on_page, + const content::PasswordFormMap& matches, + const content::PasswordForm* const preferred_match, + bool wait_for_username_before_autofill, + PasswordFormFillData* result) { + // Note that many of the |FormFieldData| members are not initialized for + // |username_field| and |password_field| because they are currently not used + // by the password autocomplete code. + FormFieldData username_field; + username_field.name = form_on_page.username_element; + username_field.value = preferred_match->username_value; + FormFieldData 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; + + // Copy additional username/value pairs. + content::PasswordFormMap::const_iterator iter; + for (iter = matches.begin(); iter != matches.end(); iter++) { + if (iter->second != preferred_match) + result->additional_logins[iter->first] = iter->second->password_value; + } +} -- cgit v1.1