| OLD | NEW |
| 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 #include "chrome/browser/search/hotword_service.h" | 5 #include "chrome/browser/search/hotword_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 ~HotwordNotificationDelegate() override {} | 261 ~HotwordNotificationDelegate() override {} |
| 262 | 262 |
| 263 Profile* profile_; | 263 Profile* profile_; |
| 264 | 264 |
| 265 DISALLOW_COPY_AND_ASSIGN(HotwordNotificationDelegate); | 265 DISALLOW_COPY_AND_ASSIGN(HotwordNotificationDelegate); |
| 266 }; | 266 }; |
| 267 | 267 |
| 268 // static | 268 // static |
| 269 bool HotwordService::DoesHotwordSupportLanguage(Profile* profile) { | 269 bool HotwordService::DoesHotwordSupportLanguage(Profile* profile) { |
| 270 std::string normalized_locale = | 270 std::string normalized_locale = |
| 271 l10n_util::NormalizeLocale(GetCurrentLocale(profile)); | 271 base::ToLowerASCII(l10n_util::NormalizeLocale(GetCurrentLocale(profile))); |
| 272 base::StringToLowerASCII(&normalized_locale); | |
| 273 | 272 |
| 274 // For M43, we are limiting always-on to en_us only. | 273 // For M43, we are limiting always-on to en_us only. |
| 275 // TODO(kcarattini): Remove this once | 274 // TODO(kcarattini): Remove this once |
| 276 // https://code.google.com/p/chrome-os-partner/issues/detail?id=39227 | 275 // https://code.google.com/p/chrome-os-partner/issues/detail?id=39227 |
| 277 // is fixed. | 276 // is fixed. |
| 278 if (HotwordServiceFactory::IsAlwaysOnAvailable()) | 277 if (HotwordServiceFactory::IsAlwaysOnAvailable()) |
| 279 return normalized_locale == "en_us"; | 278 return normalized_locale == "en_us"; |
| 280 | 279 |
| 281 for (size_t i = 0; i < arraysize(kSupportedLocales); i++) { | 280 for (size_t i = 0; i < arraysize(kSupportedLocales); i++) { |
| 282 if (normalized_locale == kSupportedLocales[i]) | 281 if (normalized_locale == kSupportedLocales[i]) |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 // Only support multiple profiles and profile switching in ChromeOS. | 875 // Only support multiple profiles and profile switching in ChromeOS. |
| 877 if (user_manager::UserManager::IsInitialized()) { | 876 if (user_manager::UserManager::IsInitialized()) { |
| 878 user_manager::User* user = | 877 user_manager::User* user = |
| 879 user_manager::UserManager::Get()->GetActiveUser(); | 878 user_manager::UserManager::Get()->GetActiveUser(); |
| 880 if (user && user->is_profile_created()) | 879 if (user && user->is_profile_created()) |
| 881 return profile_ == ProfileManager::GetActiveUserProfile(); | 880 return profile_ == ProfileManager::GetActiveUserProfile(); |
| 882 } | 881 } |
| 883 #endif | 882 #endif |
| 884 return true; | 883 return true; |
| 885 } | 884 } |
| OLD | NEW |