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

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

Issue 6484022: Autofill i18n: Set postal code and state field labels based on the selected country. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tests! Created 9 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_COUNTRY_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_COUNTRY_H_
7 #pragma once
8
9 #include <string>
10 #include <vector>
11
12 #include "base/string16.h"
13
14 // Stores data associated with a country. Strings are localized to the app
15 // locale.
16 class AutoFillCountry {
17 public:
18 // Returns country data corresponding to the two-letter ISO code
19 // |country_code|.
20 AutoFillCountry(const std::string& country_code, const std::string& locale);
21 ~AutoFillCountry();
22
23 // Fills |country_codes| with a list of the available countries' codes.
24 static void GetAvailableCountries(
25 std::vector<std::string>* country_codes);
26
27 // Returns the likely country code for |locale|, or "US" as a fallback if no
28 // mapping from the locale is available.
29 static const std::string CountryCodeForLocale(const std::string& locale);
30
31 // Returns the country code corresponding to |country|, which should be a
32 // country code or country name localized to |locale|.
33 static const std::string GetCountryCode(const string16& country,
34 const std::string& locale);
35
36 // Returns the application locale.
37 static const std::string ApplicationLocale();
38
39 const std::string country_code() const { return country_code_; }
40 const string16 name() const { return name_; }
41 const string16 postal_code_label() const { return postal_code_label_; }
42 const string16 state_label() const { return state_label_; }
43
44 private:
45 AutoFillCountry(const std::string& country_code,
46 const string16& name_,
47 const string16& postal_code_label_,
48 const string16& state_label_);
49
50 // The two-letter ISO-3166 country code.
51 std::string country_code_;
52
53 // The country's name, localized to the app locale.
54 string16 name_;
55
56 // The localized label for the postal code (or zip code) field.
57 string16 postal_code_label_;
58
59 // The localized label for the state (or province, district, etc.) field.
60 string16 state_label_;
61 };
62
63 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_COUNTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698