summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autofill/fax_field.cc2
-rw-r--r--chrome/browser/autofill/fax_field.h1
-rw-r--r--chrome/browser/autofill/form_field.h7
-rw-r--r--chrome/browser/autofill/form_structure.cc5
-rw-r--r--chrome/browser/autofill/form_structure_unittest.cc2
-rw-r--r--chrome/browser/autofill/phone_field.cc7
-rw-r--r--chrome/browser/autofill/phone_field.h1
7 files changed, 23 insertions, 2 deletions
diff --git a/chrome/browser/autofill/fax_field.cc b/chrome/browser/autofill/fax_field.cc
index a437ee0..e7b475e 100644
--- a/chrome/browser/autofill/fax_field.cc
+++ b/chrome/browser/autofill/fax_field.cc
@@ -23,3 +23,5 @@ bool FaxField::GetFieldInfo(FieldTypeMap* field_type_map) const {
}
FaxField::FaxField() : number_(NULL) {}
+
+FaxField::FaxField(const FaxField& fax_field) : number_(fax_field.number_) {}
diff --git a/chrome/browser/autofill/fax_field.h b/chrome/browser/autofill/fax_field.h
index 71228ca..c8c1dab 100644
--- a/chrome/browser/autofill/fax_field.h
+++ b/chrome/browser/autofill/fax_field.h
@@ -21,6 +21,7 @@ class FaxField : public FormField {
private:
FaxField();
+ explicit FaxField(const FaxField& fax_field);
// The fax number field.
AutoFillField* number_;
diff --git a/chrome/browser/autofill/form_field.h b/chrome/browser/autofill/form_field.h
index 61787c1..8e4ae80 100644
--- a/chrome/browser/autofill/form_field.h
+++ b/chrome/browser/autofill/form_field.h
@@ -123,6 +123,9 @@ class FormField {
const AutoFillType& type);
protected:
+ // Only derived classes may instantiate.
+ FormField() {}
+
// Note: ECML compliance checking has been modified to accommodate Google
// Checkout field name limitation. All ECML compliant web forms will be
// recognized correctly as such however the restrictions on having exactly
@@ -148,6 +151,8 @@ class FormField {
AutoFillField** dest);
static bool MatchName(AutoFillField* field, const string16& pattern);
static bool MatchLabel(AutoFillField* field, const string16& pattern);
+
+ DISALLOW_COPY_AND_ASSIGN(FormField);
};
class FormFieldSet : public std::vector<FormField*> {
@@ -163,6 +168,8 @@ class FormFieldSet : public std::vector<FormField*> {
// Checks if any of the labels are named according to the ECML standard.
// Returns true if at least one ECML named element is found.
bool CheckECML(FormStructure* fields);
+
+ DISALLOW_COPY_AND_ASSIGN(FormFieldSet);
};
#endif // CHROME_BROWSER_AUTOFILL_FORM_FIELD_H_
diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc
index febd1b4..7b7b3ea 100644
--- a/chrome/browser/autofill/form_structure.cc
+++ b/chrome/browser/autofill/form_structure.cc
@@ -169,6 +169,9 @@ void FormStructure::GetHeuristicAutoFillTypes() {
for (size_t index = 0; index < field_count(); index++) {
AutoFillField* field = fields_[index];
+ // TODO(dhollowa): Defensive check for crash happening in the field.
+ // See http://crbug.com/42211
+ CHECK(field);
FieldTypeMap::iterator iter = field_type_map.find(field->unique_name());
AutoFillFieldType heuristic_auto_fill_type;
@@ -271,7 +274,7 @@ bool FormStructure::operator!=(const FormData& form) const {
}
void FormStructure::GetHeuristicFieldInfo(FieldTypeMap* field_type_map) {
- FormFieldSet fields = FormFieldSet(this);
+ FormFieldSet fields(this);
FormFieldSet::const_iterator field;
for (field = fields.begin(); field != fields.end(); field++) {
diff --git a/chrome/browser/autofill/form_structure_unittest.cc b/chrome/browser/autofill/form_structure_unittest.cc
index ad0b383..8230364 100644
--- a/chrome/browser/autofill/form_structure_unittest.cc
+++ b/chrome/browser/autofill/form_structure_unittest.cc
@@ -338,7 +338,7 @@ TEST(FormStructureTest, HeuristicsSample8) {
EXPECT_EQ(ADDRESS_HOME_STATE, form_structure->field(5)->heuristic_type());
// Zip.
EXPECT_EQ(ADDRESS_HOME_ZIP, form_structure->field(6)->heuristic_type());
- // Zip.
+ // Country.
EXPECT_EQ(ADDRESS_HOME_COUNTRY, form_structure->field(7)->heuristic_type());
// Phone.
EXPECT_EQ(PHONE_HOME_WHOLE_NUMBER,
diff --git a/chrome/browser/autofill/phone_field.cc b/chrome/browser/autofill/phone_field.cc
index 82d4537..dfecceb 100644
--- a/chrome/browser/autofill/phone_field.cc
+++ b/chrome/browser/autofill/phone_field.cc
@@ -116,3 +116,10 @@ PhoneField::PhoneField()
prefix_(NULL),
extension_(NULL) {
}
+
+PhoneField::PhoneField(const PhoneField& phone_field)
+ : phone_(phone_field.phone_),
+ area_code_(phone_field.area_code_),
+ prefix_(phone_field.prefix_),
+ extension_(phone_field.extension_) {
+}
diff --git a/chrome/browser/autofill/phone_field.h b/chrome/browser/autofill/phone_field.h
index 6294298..72c5c2f 100644
--- a/chrome/browser/autofill/phone_field.h
+++ b/chrome/browser/autofill/phone_field.h
@@ -27,6 +27,7 @@ class PhoneField : public FormField {
protected:
PhoneField();
+ explicit PhoneField(const PhoneField& phone_field);
private:
// Always present; holds suffix if prefix is present.