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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
778 HotwordAudioHistoryHandler* HotwordService::GetAudioHistoryHandler() { | 778 HotwordAudioHistoryHandler* HotwordService::GetAudioHistoryHandler() { |
779 return audio_history_handler_.get(); | 779 return audio_history_handler_.get(); |
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() { |
Lei Zhang
2015/03/17 04:55:11
Isn't this the same as:
if (IsAlwaysOnEnabled())
kcarattini
2015/03/17 05:07:40
Well, the whole point of decoupling was to make th
Lei Zhang
2015/03/17 05:37:13
Oh, nevermind. I read the CL wrong.
| |
789 if (IsSometimesOnEnabled()) { | 789 if (IsSometimesOnEnabled()) { |
790 if (profile_->GetPrefs()->HasPrefPath(prefs::kHotwordSearchEnabled)) | 790 profile_->GetPrefs()->SetBoolean(prefs::kHotwordSearchEnabled, false); |
791 profile_->GetPrefs()->SetBoolean(prefs::kHotwordSearchEnabled, false); | 791 } |
792 } else if (IsAlwaysOnEnabled()) { | 792 if (IsAlwaysOnEnabled()) { |
793 if (profile_->GetPrefs()->HasPrefPath( | 793 profile_->GetPrefs()->SetBoolean(prefs::kHotwordAlwaysOnSearchEnabled, |
794 prefs::kHotwordAlwaysOnSearchEnabled)) { | 794 false); |
795 profile_->GetPrefs()->SetBoolean(prefs::kHotwordAlwaysOnSearchEnabled, | |
796 false); | |
797 } | |
798 } | 795 } |
799 } | 796 } |
800 | 797 |
801 void HotwordService::OnHotwordSearchEnabledChanged( | 798 void HotwordService::OnHotwordSearchEnabledChanged( |
802 const std::string& pref_name) { | 799 const std::string& pref_name) { |
803 DCHECK_EQ(pref_name, std::string(prefs::kHotwordSearchEnabled)); | 800 DCHECK_EQ(pref_name, std::string(prefs::kHotwordSearchEnabled)); |
804 | 801 |
805 ExtensionService* extension_service = GetExtensionService(profile_); | 802 ExtensionService* extension_service = GetExtensionService(profile_); |
806 if (profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled)) | 803 if (profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled)) |
807 EnableHotwordExtension(extension_service); | 804 EnableHotwordExtension(extension_service); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
888 // Only support multiple profiles and profile switching in ChromeOS. | 885 // Only support multiple profiles and profile switching in ChromeOS. |
889 if (user_manager::UserManager::IsInitialized()) { | 886 if (user_manager::UserManager::IsInitialized()) { |
890 user_manager::User* user = | 887 user_manager::User* user = |
891 user_manager::UserManager::Get()->GetActiveUser(); | 888 user_manager::UserManager::Get()->GetActiveUser(); |
892 if (user && user->is_profile_created()) | 889 if (user && user->is_profile_created()) |
893 return profile_ == ProfileManager::GetActiveUserProfile(); | 890 return profile_ == ProfileManager::GetActiveUserProfile(); |
894 } | 891 } |
895 #endif | 892 #endif |
896 return true; | 893 return true; |
897 } | 894 } |
OLD | NEW |