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

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

Issue 1011963002: Hotword: Decouple sometimes and always on prefs when disabling. They can both exist independently. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | no next file » | 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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 } 780 }
781 781
782 void HotwordService::SetAudioHistoryHandler( 782 void HotwordService::SetAudioHistoryHandler(
783 HotwordAudioHistoryHandler* handler) { 783 HotwordAudioHistoryHandler* handler) {
784 audio_history_handler_.reset(handler); 784 audio_history_handler_.reset(handler);
785 audio_history_handler_->UpdateAudioHistoryState(); 785 audio_history_handler_->UpdateAudioHistoryState();
786 } 786 }
787 787
788 void HotwordService::DisableHotwordPreferences() { 788 void HotwordService::DisableHotwordPreferences() {
789 if (IsSometimesOnEnabled()) { 789 if (IsSometimesOnEnabled()) {
790 if (profile_->GetPrefs()->HasPrefPath(prefs::kHotwordSearchEnabled)) 790 if (profile_->GetPrefs()->HasPrefPath(prefs::kHotwordSearchEnabled))
Anand Mistry (off Chromium) 2015/03/17 03:05:40 Get rid of these two HasPrefPath checks. IsFooEnab
kcarattini 2015/03/17 04:07:39 Done.
791 profile_->GetPrefs()->SetBoolean(prefs::kHotwordSearchEnabled, false); 791 profile_->GetPrefs()->SetBoolean(prefs::kHotwordSearchEnabled, false);
792 } else if (IsAlwaysOnEnabled()) { 792 }
793 if (IsAlwaysOnEnabled()) {
793 if (profile_->GetPrefs()->HasPrefPath( 794 if (profile_->GetPrefs()->HasPrefPath(
794 prefs::kHotwordAlwaysOnSearchEnabled)) { 795 prefs::kHotwordAlwaysOnSearchEnabled)) {
795 profile_->GetPrefs()->SetBoolean(prefs::kHotwordAlwaysOnSearchEnabled, 796 profile_->GetPrefs()->SetBoolean(prefs::kHotwordAlwaysOnSearchEnabled,
796 false); 797 false);
797 } 798 }
798 } 799 }
799 } 800 }
800 801
801 void HotwordService::OnHotwordSearchEnabledChanged( 802 void HotwordService::OnHotwordSearchEnabledChanged(
802 const std::string& pref_name) { 803 const std::string& pref_name) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 // Only support multiple profiles and profile switching in ChromeOS. 889 // Only support multiple profiles and profile switching in ChromeOS.
889 if (user_manager::UserManager::IsInitialized()) { 890 if (user_manager::UserManager::IsInitialized()) {
890 user_manager::User* user = 891 user_manager::User* user =
891 user_manager::UserManager::Get()->GetActiveUser(); 892 user_manager::UserManager::Get()->GetActiveUser();
892 if (user && user->is_profile_created()) 893 if (user && user->is_profile_created())
893 return profile_ == ProfileManager::GetActiveUserProfile(); 894 return profile_ == ProfileManager::GetActiveUserProfile();
894 } 895 }
895 #endif 896 #endif
896 return true; 897 return true;
897 } 898 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698