Chromium Code Reviews| Index: chrome/browser/search/hotword_service.cc |
| diff --git a/chrome/browser/search/hotword_service.cc b/chrome/browser/search/hotword_service.cc |
| index 713f9f87a819ffae3d4945bdf7b120fd54fa6fc0..422224fac7a828fcbdf072997cff64cb0d19e63c 100644 |
| --- a/chrome/browser/search/hotword_service.cc |
| +++ b/chrome/browser/search/hotword_service.cc |
| @@ -26,6 +26,21 @@ const char kHotwordFieldTrialName[] = "VoiceTrigger"; |
| const char kHotwordFieldTrialDisabledGroupName[] = "Disabled"; |
| } // namespace hotword_internal |
| +// static |
| +bool HotwordService::DoesLanguageSupportHotword(Profile* profile) { |
| + std::string locale = |
| +#if defined(OS_CHROMEOS) |
| + // On ChromeOS locale is per-profile. |
| + profile->GetPrefs()->GetString(prefs::kApplicationLocale); |
| +#else |
| + g_browser_process->GetApplicationLocale(); |
| +#endif |
| + // Only available for English now. |
| + std::string normalized_locale = l10n_util::NormalizeLocale(locale); |
| + return normalized_locale == "en" || normalized_locale == "en_us" || |
| + normalized_locale =="en_US"; |
| +} |
| + |
| HotwordService::HotwordService(Profile* profile) |
| : profile_(profile) { |
| } |
| @@ -74,17 +89,7 @@ bool HotwordService::IsHotwordAllowed() { |
| hotword_internal::kHotwordFieldTrialName); |
| if (!group.empty() && |
| group != hotword_internal::kHotwordFieldTrialDisabledGroupName) { |
| - std::string locale = |
| -#if defined(OS_CHROMEOS) |
| - // On ChromeOS locale is per-profile. |
| - profile_->GetPrefs()->GetString(prefs::kApplicationLocale); |
| -#else |
| - g_browser_process->GetApplicationLocale(); |
| -#endif |
| - // Only available for English now. |
| - std::string normalized_locale = l10n_util::NormalizeLocale(locale); |
| - return normalized_locale == "en" || normalized_locale == "en_us" || |
| - normalized_locale =="en_US"; |
| + return DoesLanguageSupportHotword(profile_); |
|
rpetterson
2014/02/09 18:27:19
The if statement is no longer necessary. Just
ret
Jun Mukai
2014/02/10 20:50:37
Done.
|
| } |
| return false; |
| } |