diff options
author | blundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-05 01:29:14 +0000 |
---|---|---|
committer | blundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-05 01:29:14 +0000 |
commit | 1ecbe866c38fb6c781d337393b7ff62d0c662f4e (patch) | |
tree | 37ddf68241e68df9035f2c612388369f1539fe4d /chrome/common/form_field_data.cc | |
parent | 456cface8888f0e39742243f25295d55c8922744 (diff) | |
download | chromium_src-1ecbe866c38fb6c781d337393b7ff62d0c662f4e.zip chromium_src-1ecbe866c38fb6c781d337393b7ff62d0c662f4e.tar.gz chromium_src-1ecbe866c38fb6c781d337393b7ff62d0c662f4e.tar.bz2 |
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
Diffstat (limited to 'chrome/common/form_field_data.cc')
-rw-r--r-- | chrome/common/form_field_data.cc | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/chrome/common/form_field_data.cc b/chrome/common/form_field_data.cc new file mode 100644 index 0000000..cd134d4 --- /dev/null +++ b/chrome/common/form_field_data.cc @@ -0,0 +1,60 @@ +// Copyright (c) 2012 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/form_field_data.h" + +#include "base/string_util.h" +#include "base/utf_string_conversions.h" + +FormFieldData::FormFieldData() + : max_length(0), + is_autofilled(false), + is_focusable(false), + should_autocomplete(false) { +} + +FormFieldData::~FormFieldData() { +} + +bool FormFieldData::operator==(const FormFieldData& field) const { + // A FormFieldData stores a value, but the value is not part of the identity + // of the field, so we don't want to compare the values. + return (label == field.label && + name == field.name && + form_control_type == field.form_control_type && + autocomplete_type == field.autocomplete_type && + max_length == field.max_length); +} + +bool FormFieldData::operator!=(const FormFieldData& field) const { + return !operator==(field); +} + +bool FormFieldData::operator<(const FormFieldData& field) const { + if (label == field.label) + return name < field.name; + + return label < field.label; +} + +std::ostream& operator<<(std::ostream& os, const FormFieldData& field) { + return os + << UTF16ToUTF8(field.label) + << " " + << UTF16ToUTF8(field.name) + << " " + << UTF16ToUTF8(field.value) + << " " + << UTF16ToUTF8(field.form_control_type) + << " " + << UTF16ToUTF8(field.autocomplete_type) + << " " + << field.max_length + << " " + << (field.is_autofilled ? "true" : "false") + << " " + << (field.is_focusable ? "true" : "false") + << " " + << (field.should_autocomplete ? "true" : "false"); +} |