diff options
author | miu@chromium.org <miu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-15 21:30:58 +0000 |
---|---|---|
committer | miu@chromium.org <miu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-15 21:30:58 +0000 |
commit | 016af54060c480dd1473e10f86bbf67f1fce85de (patch) | |
tree | 87b4919e28525a53bcaa722c90c5f7f4027f8320 /ui | |
parent | 748e647a09bf44eb993022f31495efd5b58e7d3d (diff) | |
download | chromium_src-016af54060c480dd1473e10f86bbf67f1fce85de.zip chromium_src-016af54060c480dd1473e10f86bbf67f1fce85de.tar.gz chromium_src-016af54060c480dd1473e10f86bbf67f1fce85de.tar.bz2 |
Revert of ChromeOS: should not show "Language changed" notification for certain languages. (patchset #6 of https://codereview.chromium.org/382973002/)
Reason for revert:
Link failure of browser_tests on ChromiumOS build bot:
http://build.chromium.org/p/chromium.chromiumos/buildstatus?builder=Linux%20ChromiumOS%20Builder%20%28dbg%29&number=50192
Original issue's description:
> ChromeOS: should not show "Language changed" notification for certain languages.
>
> BUG=317718
> TEST=manually tested
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=289985
NOTREECHECKS=true
NOTRY=true
TBR=alemate@chromium.org, nkostylev@chromium.org, jshin@chromium.org
Review URL: https://codereview.chromium.org/471403005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/l10n/l10n_util.cc | 20 | ||||
-rw-r--r-- | ui/base/l10n/l10n_util.h | 7 |
2 files changed, 4 insertions, 23 deletions
diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc index 54b2848..55c4d04 100644 --- a/ui/base/l10n/l10n_util.cc +++ b/ui/base/l10n/l10n_util.cc @@ -311,11 +311,6 @@ std::string GetCanonicalLocale(const std::string& locale) { return base::i18n::GetCanonicalLocale(locale.c_str()); } -std::string GetLanguage(const std::string& locale) { - const std::string::size_type hyphen_pos = locale.find('-'); - return std::string(locale, 0, hyphen_pos); -} - bool CheckAndResolveLocale(const std::string& locale, std::string* resolved_locale) { #if defined(OS_MACOSX) @@ -339,9 +334,10 @@ bool CheckAndResolveLocale(const std::string& locale, // does not support but available on Windows. We fall // back to en-US in GetApplicationLocale so that it's a not critical, // but we can do better. - const std::string lang(GetLanguage(locale)); - if (lang.size() < locale.size()) { - std::string region(locale, lang.size() + 1); + std::string::size_type hyphen_pos = locale.find('-'); + std::string lang(locale, 0, hyphen_pos); + if (hyphen_pos != std::string::npos && hyphen_pos > 0) { + std::string region(locale, hyphen_pos + 1); std::string tmp_locale(lang); // Map es-RR other than es-ES to es-419 (Chrome's Latin American // Spanish locale). @@ -881,12 +877,4 @@ int GetLocalizedContentsWidthInPixels(int pixel_resource_id) { return width; } -const char* const* GetAcceptLanguageListForTesting() { - return kAcceptLanguageList; -} - -size_t GetAcceptLanguageListSizeForTesting() { - return arraysize(kAcceptLanguageList); -} - } // namespace l10n_util diff --git a/ui/base/l10n/l10n_util.h b/ui/base/l10n/l10n_util.h index bc0ff60..a71240c 100644 --- a/ui/base/l10n/l10n_util.h +++ b/ui/base/l10n/l10n_util.h @@ -24,9 +24,6 @@ namespace l10n_util { // std::string as an argument. UI_BASE_EXPORT std::string GetCanonicalLocale(const std::string& locale); -// Takes normalized locale as |locale|. Returns language part (before '-'). -UI_BASE_EXPORT std::string GetLanguage(const std::string& locale); - // This method translates a generic locale name to one of the locally defined // ones. This method returns true if it succeeds. UI_BASE_EXPORT bool CheckAndResolveLocale(const std::string& locale, @@ -188,10 +185,6 @@ UI_BASE_EXPORT void GetAcceptLanguagesForLocale( // designer given constraints which might dependent on the language used. UI_BASE_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); -const char* const* GetAcceptLanguageListForTesting(); - -size_t GetAcceptLanguageListSizeForTesting(); - } // namespace l10n_util #endif // UI_BASE_L10N_L10N_UTIL_H_ |