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

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

Issue 6673079: Reduce boxing and unboxing of AutofillFieldType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
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 #ifndef CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_
6 #define CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ 6 #define CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "chrome/browser/autofill/autofill_type.h"
13 #include "chrome/browser/autofill/form_group.h" 14 #include "chrome/browser/autofill/form_group.h"
14 15
15 // A form group that stores phone number information. 16 // A form group that stores phone number information.
16 class PhoneNumber : public FormGroup { 17 class PhoneNumber : public FormGroup {
17 public: 18 public:
18 PhoneNumber(); 19 PhoneNumber();
19 explicit PhoneNumber(const PhoneNumber& number); 20 explicit PhoneNumber(const PhoneNumber& number);
20 virtual ~PhoneNumber(); 21 virtual ~PhoneNumber();
21 22
22 PhoneNumber& operator=(const PhoneNumber& number); 23 PhoneNumber& operator=(const PhoneNumber& number);
23 24
24 // FormGroup implementation: 25 // FormGroup implementation:
25 virtual void GetPossibleFieldTypes(const string16& text, 26 virtual void GetPossibleFieldTypes(const string16& text,
26 FieldTypeSet* possible_types) const; 27 FieldTypeSet* possible_types) const;
27 virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; 28 virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const;
28 virtual void FindInfoMatches(const AutofillType& type, 29 virtual void FindInfoMatches(AutofillFieldType type,
29 const string16& info, 30 const string16& info,
30 std::vector<string16>* matched_text) const; 31 std::vector<string16>* matched_text) const;
31 virtual string16 GetFieldText(const AutofillType& type) const; 32 virtual string16 GetFieldText(AutofillFieldType type) const;
32 virtual void SetInfo(const AutofillType& type, const string16& value); 33 virtual void SetInfo(AutofillFieldType type, const string16& value);
33 34
34 // Parses |value| to extract the components of a phone number. |number| 35 // Parses |value| to extract the components of a phone number. |number|
35 // returns the trailing 7 digits, |city_code| returns the next 3 digits, and 36 // returns the trailing 7 digits, |city_code| returns the next 3 digits, and
36 // |country_code| returns any remaining digits. 37 // |country_code| returns any remaining digits.
37 // Separator characters are stripped before parsing the digits. 38 // Separator characters are stripped before parsing the digits.
38 // Returns true if parsing was successful, false otherwise. 39 // Returns true if parsing was successful, false otherwise.
39 static bool ParsePhoneNumber(const string16& value, 40 static bool ParsePhoneNumber(const string16& value,
40 string16* number, 41 string16* number,
41 string16* city_code, 42 string16* city_code,
42 string16* country_code); 43 string16* country_code);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 static void StripPunctuation(string16* number); 97 static void StripPunctuation(string16* number);
97 98
98 // The pieces of the phone number. 99 // The pieces of the phone number.
99 string16 country_code_; 100 string16 country_code_;
100 string16 city_code_; // city or area code. 101 string16 city_code_; // city or area code.
101 string16 number_; 102 string16 number_;
102 string16 extension_; 103 string16 extension_;
103 }; 104 };
104 105
105 #endif // CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ 106 #endif // CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autofill/personal_data_manager_unittest.cc ('k') | chrome/browser/autofill/phone_number.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698