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

Side by Side Diff: components/autofill/core/browser/phone_number_i18n.h

Issue 24538008: rAc: phone number cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixme Created 7 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_I18N_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_I18N_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_I18N_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_I18N_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 const std::string& region, 57 const std::string& region,
58 base::string16* whole_number) WARN_UNUSED_RESULT; 58 base::string16* whole_number) WARN_UNUSED_RESULT;
59 59
60 // Returns true if |number_a| and |number_b| parse to the same phone number in 60 // Returns true if |number_a| and |number_b| parse to the same phone number in
61 // the given |region|. 61 // the given |region|.
62 bool PhoneNumbersMatch(const base::string16& number_a, 62 bool PhoneNumbersMatch(const base::string16& number_a,
63 const base::string16& number_b, 63 const base::string16& number_b,
64 const std::string& region, 64 const std::string& region,
65 const std::string& app_locale); 65 const std::string& app_locale);
66 66
67 // Takes a phone number provided by a user and returns a string formatted for
68 // display in the national format of the region defined by |region|. If
69 // the phone number could not be parsed this may return an empty string.
70 base::string16 FormatPhoneNumberForRegion(const base::string16& whole_number,
71 const std::string& region);
72
67 // The cached phone number, does parsing only once, improves performance. 73 // The cached phone number, does parsing only once, improves performance.
68 class PhoneObject { 74 class PhoneObject {
69 public: 75 public:
70 PhoneObject(const base::string16& number, 76 PhoneObject(const base::string16& number,
71 const std::string& region); 77 const std::string& region);
72 PhoneObject(const PhoneObject&); 78 PhoneObject(const PhoneObject&);
73 PhoneObject(); 79 PhoneObject();
74 ~PhoneObject(); 80 ~PhoneObject();
75 81
76 std::string region() const { return region_; } 82 std::string region() const { return region_; }
(...skipping 26 matching lines...) Expand all
103 109
104 // The whole number, normalized to contain only digits if possible. 110 // The whole number, normalized to contain only digits if possible.
105 // Set on first request. 111 // Set on first request.
106 mutable base::string16 whole_number_; 112 mutable base::string16 whole_number_;
107 }; 113 };
108 114
109 } // namespace i18n 115 } // namespace i18n
110 } // namespace autofill 116 } // namespace autofill
111 117
112 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_I18N_H_ 118 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_I18N_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698