Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: chrome/browser/search/hotword_service.cc

Issue 1218693004: Add build flag to disable hotwording. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2403
Patch Set: Resolve merge conflict. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/search/hotword_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/search/hotword_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698