| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/autofill/contact_info.h" | 5 #include "chrome/browser/autofill/contact_info.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/autofill/autofill_type.h" | 10 #include "chrome/browser/autofill/autofill_type.h" |
| 11 #include "chrome/browser/autofill/field_types.h" | 11 #include "chrome/browser/autofill/field_types.h" |
| 12 | 12 |
| 13 static const string16 kNameSplitChars = ASCIIToUTF16("-'. "); | 13 static const string16 kNameSplitChars = ASCIIToUTF16("-'. "); |
| 14 | 14 |
| 15 static const AutoFillFieldType kAutoFillContactInfoTypes[] = { | 15 static const AutoFillFieldType kAutoFillContactInfoTypes[] = { |
| 16 NAME_FIRST, | 16 NAME_FIRST, |
| 17 NAME_MIDDLE, | 17 NAME_MIDDLE, |
| 18 NAME_LAST, | 18 NAME_LAST, |
| 19 EMAIL_ADDRESS, | 19 EMAIL_ADDRESS, |
| 20 COMPANY_NAME, | 20 COMPANY_NAME, |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 static const size_t kAutoFillContactInfoLength = | 23 static const size_t kAutoFillContactInfoLength = |
| 24 arraysize(kAutoFillContactInfoTypes); | 24 arraysize(kAutoFillContactInfoTypes); |
| 25 | 25 |
| 26 ContactInfo::ContactInfo() {} |
| 27 |
| 28 ContactInfo::~ContactInfo() {} |
| 29 |
| 26 FormGroup* ContactInfo::Clone() const { | 30 FormGroup* ContactInfo::Clone() const { |
| 27 return new ContactInfo(*this); | 31 return new ContactInfo(*this); |
| 28 } | 32 } |
| 29 | 33 |
| 30 void ContactInfo::GetPossibleFieldTypes(const string16& text, | 34 void ContactInfo::GetPossibleFieldTypes(const string16& text, |
| 31 FieldTypeSet* possible_types) const { | 35 FieldTypeSet* possible_types) const { |
| 32 DCHECK(possible_types); | 36 DCHECK(possible_types); |
| 33 | 37 |
| 34 if (IsFirstName(text)) | 38 if (IsFirstName(text)) |
| 35 possible_types->insert(NAME_FIRST); | 39 possible_types->insert(NAME_FIRST); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 SetLast(full_name_tokens.back()); | 408 SetLast(full_name_tokens.back()); |
| 405 if (full_name_tokens.size() > 2) { | 409 if (full_name_tokens.size() > 2) { |
| 406 full_name_tokens.erase(full_name_tokens.begin()); | 410 full_name_tokens.erase(full_name_tokens.begin()); |
| 407 full_name_tokens.pop_back(); | 411 full_name_tokens.pop_back(); |
| 408 SetMiddle(JoinString(full_name_tokens, ' ')); | 412 SetMiddle(JoinString(full_name_tokens, ' ')); |
| 409 } | 413 } |
| 410 } | 414 } |
| 411 } | 415 } |
| 412 } | 416 } |
| 413 | 417 |
| OLD | NEW |