| 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 632     bool audio_capture_allowed = | 632     bool audio_capture_allowed = | 
| 633         profile_->GetPrefs()->GetBoolean(prefs::kAudioCaptureAllowed); | 633         profile_->GetPrefs()->GetBoolean(prefs::kAudioCaptureAllowed); | 
| 634     if (!audio_capture_allowed || !microphone_available_) | 634     if (!audio_capture_allowed || !microphone_available_) | 
| 635       error_message_ = IDS_HOTWORD_MICROPHONE_ERROR_MESSAGE; | 635       error_message_ = IDS_HOTWORD_MICROPHONE_ERROR_MESSAGE; | 
| 636   } | 636   } | 
| 637 | 637 | 
| 638   return (error_message_ == 0) && IsHotwordAllowed(); | 638   return (error_message_ == 0) && IsHotwordAllowed(); | 
| 639 } | 639 } | 
| 640 | 640 | 
| 641 bool HotwordService::IsHotwordAllowed() { | 641 bool HotwordService::IsHotwordAllowed() { | 
|  | 642 #if defined(ENABLE_HOTWORDING) | 
| 642   return DoesHotwordSupportLanguage(profile_); | 643   return DoesHotwordSupportLanguage(profile_); | 
|  | 644 #else | 
|  | 645   return false; | 
|  | 646 #endif | 
| 643 } | 647 } | 
| 644 | 648 | 
| 645 bool HotwordService::IsOptedIntoAudioLogging() { | 649 bool HotwordService::IsOptedIntoAudioLogging() { | 
| 646   // Do not opt the user in if the preference has not been set. | 650   // Do not opt the user in if the preference has not been set. | 
| 647   return | 651   return | 
| 648       profile_->GetPrefs()->HasPrefPath(prefs::kHotwordAudioLoggingEnabled) && | 652       profile_->GetPrefs()->HasPrefPath(prefs::kHotwordAudioLoggingEnabled) && | 
| 649       profile_->GetPrefs()->GetBoolean(prefs::kHotwordAudioLoggingEnabled); | 653       profile_->GetPrefs()->GetBoolean(prefs::kHotwordAudioLoggingEnabled); | 
| 650 } | 654 } | 
| 651 | 655 | 
| 652 bool HotwordService::IsAlwaysOnEnabled() { | 656 bool HotwordService::IsAlwaysOnEnabled() { | 
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 871   // Only support multiple profiles and profile switching in ChromeOS. | 875   // Only support multiple profiles and profile switching in ChromeOS. | 
| 872   if (user_manager::UserManager::IsInitialized()) { | 876   if (user_manager::UserManager::IsInitialized()) { | 
| 873     user_manager::User* user = | 877     user_manager::User* user = | 
| 874         user_manager::UserManager::Get()->GetActiveUser(); | 878         user_manager::UserManager::Get()->GetActiveUser(); | 
| 875     if (user && user->is_profile_created()) | 879     if (user && user->is_profile_created()) | 
| 876       return profile_ == ProfileManager::GetActiveUserProfile(); | 880       return profile_ == ProfileManager::GetActiveUserProfile(); | 
| 877   } | 881   } | 
| 878 #endif | 882 #endif | 
| 879   return true; | 883   return true; | 
| 880 } | 884 } | 
| OLD | NEW | 
|---|