| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 bool audio_capture_allowed = | 635 bool audio_capture_allowed = |
| 636 profile_->GetPrefs()->GetBoolean(prefs::kAudioCaptureAllowed); | 636 profile_->GetPrefs()->GetBoolean(prefs::kAudioCaptureAllowed); |
| 637 if (!audio_capture_allowed || !microphone_available_) | 637 if (!audio_capture_allowed || !microphone_available_) |
| 638 error_message_ = IDS_HOTWORD_MICROPHONE_ERROR_MESSAGE; | 638 error_message_ = IDS_HOTWORD_MICROPHONE_ERROR_MESSAGE; |
| 639 } | 639 } |
| 640 | 640 |
| 641 return (error_message_ == 0) && IsHotwordAllowed(); | 641 return (error_message_ == 0) && IsHotwordAllowed(); |
| 642 } | 642 } |
| 643 | 643 |
| 644 bool HotwordService::IsHotwordAllowed() { | 644 bool HotwordService::IsHotwordAllowed() { |
| 645 #if defined(ENABLE_HOTWORDING) |
| 645 std::string group = base::FieldTrialList::FindFullName( | 646 std::string group = base::FieldTrialList::FindFullName( |
| 646 hotword_internal::kHotwordFieldTrialName); | 647 hotword_internal::kHotwordFieldTrialName); |
| 647 // Allow hotwording by default, and only disable if the field trial has been | 648 // Allow hotwording by default, and only disable if the field trial has been |
| 648 // set. | 649 // set. |
| 649 if (group == hotword_internal::kHotwordFieldTrialDisabledGroupName) | 650 if (group == hotword_internal::kHotwordFieldTrialDisabledGroupName) |
| 650 return false; | 651 return false; |
| 651 | 652 |
| 652 return DoesHotwordSupportLanguage(profile_); | 653 return DoesHotwordSupportLanguage(profile_); |
| 654 #else |
| 655 return false; |
| 656 #endif |
| 653 } | 657 } |
| 654 | 658 |
| 655 bool HotwordService::IsOptedIntoAudioLogging() { | 659 bool HotwordService::IsOptedIntoAudioLogging() { |
| 656 // Do not opt the user in if the preference has not been set. | 660 // Do not opt the user in if the preference has not been set. |
| 657 return | 661 return |
| 658 profile_->GetPrefs()->HasPrefPath(prefs::kHotwordAudioLoggingEnabled) && | 662 profile_->GetPrefs()->HasPrefPath(prefs::kHotwordAudioLoggingEnabled) && |
| 659 profile_->GetPrefs()->GetBoolean(prefs::kHotwordAudioLoggingEnabled); | 663 profile_->GetPrefs()->GetBoolean(prefs::kHotwordAudioLoggingEnabled); |
| 660 } | 664 } |
| 661 | 665 |
| 662 bool HotwordService::IsAlwaysOnEnabled() { | 666 bool HotwordService::IsAlwaysOnEnabled() { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 // Only support multiple profiles and profile switching in ChromeOS. | 879 // Only support multiple profiles and profile switching in ChromeOS. |
| 876 if (user_manager::UserManager::IsInitialized()) { | 880 if (user_manager::UserManager::IsInitialized()) { |
| 877 user_manager::User* user = | 881 user_manager::User* user = |
| 878 user_manager::UserManager::Get()->GetActiveUser(); | 882 user_manager::UserManager::Get()->GetActiveUser(); |
| 879 if (user && user->is_profile_created()) | 883 if (user && user->is_profile_created()) |
| 880 return profile_ == ProfileManager::GetActiveUserProfile(); | 884 return profile_ == ProfileManager::GetActiveUserProfile(); |
| 881 } | 885 } |
| 882 #endif | 886 #endif |
| 883 return true; | 887 return true; |
| 884 } | 888 } |
| OLD | NEW |