Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/autofill_country.h" | 5 #include "components/autofill/browser/autofill_country.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/i18n/rtl.h" | |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
| 15 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 17 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
| 18 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/content_browser_client.h" | |
| 21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 22 #include "third_party/icu/public/common/unicode/locid.h" | 22 #include "third_party/icu/public/common/unicode/locid.h" |
| 23 #include "third_party/icu/public/common/unicode/uloc.h" | 23 #include "third_party/icu/public/common/unicode/uloc.h" |
| 24 #include "third_party/icu/public/common/unicode/unistr.h" | 24 #include "third_party/icu/public/common/unicode/unistr.h" |
| 25 #include "third_party/icu/public/common/unicode/urename.h" | 25 #include "third_party/icu/public/common/unicode/urename.h" |
| 26 #include "third_party/icu/public/common/unicode/utypes.h" | 26 #include "third_party/icu/public/common/unicode/utypes.h" |
| 27 #include "third_party/icu/public/i18n/unicode/coll.h" | 27 #include "third_party/icu/public/i18n/unicode/coll.h" |
| 28 #include "third_party/icu/public/i18n/unicode/ucol.h" | 28 #include "third_party/icu/public/i18n/unicode/ucol.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 30 | 30 |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 667 | 667 |
| 668 const std::string CountryNames::ApplicationLocale() { | 668 const std::string CountryNames::ApplicationLocale() { |
| 669 if (application_locale_.empty()) { | 669 if (application_locale_.empty()) { |
| 670 // In production code, this class is always constructed on the UI thread, so | 670 // In production code, this class is always constructed on the UI thread, so |
| 671 // the two conditions in the below DCHECK are identical. In test code, | 671 // the two conditions in the below DCHECK are identical. In test code, |
| 672 // sometimes there is a UI thread, and sometimes there is just the unnamed | 672 // sometimes there is a UI thread, and sometimes there is just the unnamed |
| 673 // main thread. Since this class is a singleton, it needs to support both | 673 // main thread. Since this class is a singleton, it needs to support both |
| 674 // cases. Hence, the somewhat strange looking DCHECK below. | 674 // cases. Hence, the somewhat strange looking DCHECK below. |
| 675 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || | 675 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
| 676 thread_checker_.CalledOnValidThread()); | 676 thread_checker_.CalledOnValidThread()); |
| 677 application_locale_ = | 677 application_locale_ = base::i18n::GetConfiguredLocale(); |
|
Ilya Sherman
2013/04/03 23:51:18
Can you use g_browser_process->GetApplicationLocal
jam
2013/04/04 02:45:15
no, since src\components can't depend on src\chrom
Ilya Sherman
2013/04/04 04:05:36
Ah, right, we've been componentized. *sigh*
jam
2013/04/04 17:58:35
are you planning on fixing this soon? I had looked
| |
| 678 content::GetContentClient()->browser()->GetApplicationLocale(); | |
| 679 } | 678 } |
| 680 | 679 |
| 681 return application_locale_; | 680 return application_locale_; |
| 682 } | 681 } |
| 683 | 682 |
| 684 CountryNames::CountryNames() { | 683 CountryNames::CountryNames() { |
| 685 // Add 2- and 3-letter ISO country codes. | 684 // Add 2- and 3-letter ISO country codes. |
| 686 for (CountryDataMap::Iterator it = CountryDataMap::Begin(); | 685 for (CountryDataMap::Iterator it = CountryDataMap::Begin(); |
| 687 it != CountryDataMap::End(); | 686 it != CountryDataMap::End(); |
| 688 ++it) { | 687 ++it) { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 887 | 886 |
| 888 AutofillCountry::AutofillCountry(const std::string& country_code, | 887 AutofillCountry::AutofillCountry(const std::string& country_code, |
| 889 const string16& name, | 888 const string16& name, |
| 890 const string16& postal_code_label, | 889 const string16& postal_code_label, |
| 891 const string16& state_label) | 890 const string16& state_label) |
| 892 : country_code_(country_code), | 891 : country_code_(country_code), |
| 893 name_(name), | 892 name_(name), |
| 894 postal_code_label_(postal_code_label), | 893 postal_code_label_(postal_code_label), |
| 895 state_label_(state_label) { | 894 state_label_(state_label) { |
| 896 } | 895 } |
| OLD | NEW |