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

Side by Side Diff: components/autofill/browser/phone_field.cc

Issue 13973004: Convert string16 -> base::string16 in components/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
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 "components/autofill/browser/phone_field.h" 5 #include "components/autofill/browser/phone_field.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "components/autofill/browser/autofill_field.h" 12 #include "components/autofill/browser/autofill_field.h"
13 #include "components/autofill/browser/autofill_regex_constants.h" 13 #include "components/autofill/browser/autofill_regex_constants.h"
14 #include "components/autofill/browser/autofill_scanner.h" 14 #include "components/autofill/browser/autofill_scanner.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 16
17 namespace { 17 namespace {
18 18
19 // This string includes all area code separators, including NoText. 19 // This string includes all area code separators, including NoText.
20 string16 GetAreaRegex() { 20 base::string16 GetAreaRegex() {
21 string16 area_code = UTF8ToUTF16(autofill::kAreaCodeRe); 21 base::string16 area_code = UTF8ToUTF16(autofill::kAreaCodeRe);
22 area_code.append(ASCIIToUTF16("|")); // Regexp separator. 22 area_code.append(ASCIIToUTF16("|")); // Regexp separator.
23 area_code.append(UTF8ToUTF16(autofill::kAreaCodeNotextRe)); 23 area_code.append(UTF8ToUTF16(autofill::kAreaCodeNotextRe));
24 return area_code; 24 return area_code;
25 } 25 }
26 26
27 } // namespace 27 } // namespace
28 28
29 PhoneField::~PhoneField() {} 29 PhoneField::~PhoneField() {}
30 30
31 // Phone field grammars - first matched grammar will be parsed. Grammars are 31 // Phone field grammars - first matched grammar will be parsed. Grammars are
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 238 }
239 239
240 return ok; 240 return ok;
241 } 241 }
242 242
243 PhoneField::PhoneField() { 243 PhoneField::PhoneField() {
244 memset(parsed_phone_fields_, 0, sizeof(parsed_phone_fields_)); 244 memset(parsed_phone_fields_, 0, sizeof(parsed_phone_fields_));
245 } 245 }
246 246
247 // static 247 // static
248 string16 PhoneField::GetRegExp(RegexType regex_id) { 248 base::string16 PhoneField::GetRegExp(RegexType regex_id) {
249 switch (regex_id) { 249 switch (regex_id) {
250 case REGEX_COUNTRY: 250 case REGEX_COUNTRY:
251 return UTF8ToUTF16(autofill::kCountryCodeRe); 251 return UTF8ToUTF16(autofill::kCountryCodeRe);
252 case REGEX_AREA: 252 case REGEX_AREA:
253 return GetAreaRegex(); 253 return GetAreaRegex();
254 case REGEX_AREA_NOTEXT: 254 case REGEX_AREA_NOTEXT:
255 return UTF8ToUTF16(autofill::kAreaCodeNotextRe); 255 return UTF8ToUTF16(autofill::kAreaCodeNotextRe);
256 case REGEX_PHONE: 256 case REGEX_PHONE:
257 return UTF8ToUTF16(autofill::kPhoneRe); 257 return UTF8ToUTF16(autofill::kPhoneRe);
258 case REGEX_PREFIX_SEPARATOR: 258 case REGEX_PREFIX_SEPARATOR:
259 return UTF8ToUTF16(autofill::kPhonePrefixSeparatorRe); 259 return UTF8ToUTF16(autofill::kPhonePrefixSeparatorRe);
260 case REGEX_PREFIX: 260 case REGEX_PREFIX:
261 return UTF8ToUTF16(autofill::kPhonePrefixRe); 261 return UTF8ToUTF16(autofill::kPhonePrefixRe);
262 case REGEX_SUFFIX_SEPARATOR: 262 case REGEX_SUFFIX_SEPARATOR:
263 return UTF8ToUTF16(autofill::kPhoneSuffixSeparatorRe); 263 return UTF8ToUTF16(autofill::kPhoneSuffixSeparatorRe);
264 case REGEX_SUFFIX: 264 case REGEX_SUFFIX:
265 return UTF8ToUTF16(autofill::kPhoneSuffixRe); 265 return UTF8ToUTF16(autofill::kPhoneSuffixRe);
266 case REGEX_EXTENSION: 266 case REGEX_EXTENSION:
267 return UTF8ToUTF16(autofill::kPhoneExtensionRe); 267 return UTF8ToUTF16(autofill::kPhoneExtensionRe);
268 default: 268 default:
269 NOTREACHED(); 269 NOTREACHED();
270 break; 270 break;
271 } 271 }
272 return string16(); 272 return base::string16();
273 } 273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698