blob: 56f057f86394e009732b366436637d89908937ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright (c) 2009 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 "webkit/glue/form_field.h"
#include "base/string_util.h"
using WebKit::WebInputElement;
namespace webkit_glue {
FormField::FormField() {
}
FormField::FormField(const WebInputElement& input_element) {
name_ = input_element.nameForAutofill();
// TODO(jhawkins): Extract the field label. For now we just use the field
// name.
label_ = name_;
value_ = input_element.value();
TrimWhitespace(value_, TRIM_LEADING, &value_);
form_control_type_ = input_element.formControlType();
input_type_ = input_element.inputType();
}
FormField::FormField(const string16& label,
const string16& name,
const string16& value,
const string16& form_control_type,
WebInputElement::InputType input_type)
: label_(label),
name_(name),
value_(value),
form_control_type_(form_control_type),
input_type_(input_type) {
}
bool FormField::operator!=(const FormField& field) {
// A FormField 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_ ||
input_type_ != field.input_type_);
}
} // namespace webkit_glue
|