Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: chrome/browser/autofill/phone_number.cc

Issue 6650014: Autofill extend profiles to include multi-valued fields, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/autofill/phone_number.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/phone_number.h" 5 #include "chrome/browser/autofill/phone_number.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 "chrome/browser/autofill/autofill_profile.h" 9 #include "chrome/browser/autofill/autofill_profile.h"
10 #include "chrome/browser/autofill/autofill_type.h" 10 #include "chrome/browser/autofill/autofill_type.h"
(...skipping 16 matching lines...) Expand all
27 AutofillType::PHONE_CITY_AND_NUMBER, 27 AutofillType::PHONE_CITY_AND_NUMBER,
28 AutofillType::PHONE_WHOLE_NUMBER, 28 AutofillType::PHONE_WHOLE_NUMBER,
29 }; 29 };
30 30
31 const int kAutoFillPhoneLength = arraysize(kAutoFillPhoneTypes); 31 const int kAutoFillPhoneLength = arraysize(kAutoFillPhoneTypes);
32 32
33 } // namespace 33 } // namespace
34 34
35 PhoneNumber::PhoneNumber() {} 35 PhoneNumber::PhoneNumber() {}
36 36
37 PhoneNumber::PhoneNumber(const PhoneNumber& number) : FormGroup() {
38 *this = number;
39 }
40
37 PhoneNumber::~PhoneNumber() {} 41 PhoneNumber::~PhoneNumber() {}
38 42
43 PhoneNumber& PhoneNumber::operator=(const PhoneNumber& number) {
44 if (this == &number)
45 return *this;
46 country_code_ = number.country_code_;
47 city_code_ = number.city_code_;
48 number_ = number.number_;
49 extension_ = number.extension_;
50 return *this;
51 }
52
39 void PhoneNumber::GetPossibleFieldTypes(const string16& text, 53 void PhoneNumber::GetPossibleFieldTypes(const string16& text,
40 FieldTypeSet* possible_types) const { 54 FieldTypeSet* possible_types) const {
41 string16 stripped_text(text); 55 string16 stripped_text(text);
42 StripPunctuation(&stripped_text); 56 StripPunctuation(&stripped_text);
43 if (!Validate(stripped_text)) 57 if (!Validate(stripped_text))
44 return; 58 return;
45 59
46 if (IsNumber(stripped_text)) 60 if (IsNumber(stripped_text))
47 possible_types->insert(GetNumberType()); 61 possible_types->insert(GetNumberType());
48 62
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 219 }
206 220
207 void PhoneNumber::set_whole_number(const string16& whole_number) { 221 void PhoneNumber::set_whole_number(const string16& whole_number) {
208 string16 number, city_code, country_code; 222 string16 number, city_code, country_code;
209 ParsePhoneNumber(whole_number, &number, &city_code, &country_code); 223 ParsePhoneNumber(whole_number, &number, &city_code, &country_code);
210 set_number(number); 224 set_number(number);
211 set_city_code(city_code); 225 set_city_code(city_code);
212 set_country_code(country_code); 226 set_country_code(country_code);
213 } 227 }
214 228
215 PhoneNumber::PhoneNumber(const PhoneNumber& phone_number)
216 : FormGroup(),
217 country_code_(phone_number.country_code_),
218 city_code_(phone_number.city_code_),
219 number_(phone_number.number_),
220 extension_(phone_number.extension_) {
221 }
222
223 bool PhoneNumber::FindInfoMatchesHelper(const FieldTypeSubGroup& subgroup, 229 bool PhoneNumber::FindInfoMatchesHelper(const FieldTypeSubGroup& subgroup,
224 const string16& info, 230 const string16& info,
225 string16* match) const { 231 string16* match) const {
226 if (match == NULL) { 232 if (match == NULL) {
227 DLOG(ERROR) << "NULL match string passed in"; 233 DLOG(ERROR) << "NULL match string passed in";
228 return false; 234 return false;
229 } 235 }
230 236
231 match->clear(); 237 match->clear();
232 if (subgroup == AutofillType::PHONE_NUMBER && 238 if (subgroup == AutofillType::PHONE_NUMBER &&
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return false; 298 return false;
293 } 299 }
294 300
295 return true; 301 return true;
296 } 302 }
297 303
298 // Static. 304 // Static.
299 void PhoneNumber::StripPunctuation(string16* number) { 305 void PhoneNumber::StripPunctuation(string16* number) {
300 RemoveChars(*number, kPhoneNumberSeparators, number); 306 RemoveChars(*number, kPhoneNumberSeparators, number);
301 } 307 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/phone_number.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698