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

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

Issue 780703004: [Hotword] Ok Google options disappear if search provider is changed from (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comment Created 6 years 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
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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 736
737 HotwordAudioHistoryHandler* HotwordService::GetAudioHistoryHandler() { 737 HotwordAudioHistoryHandler* HotwordService::GetAudioHistoryHandler() {
738 return audio_history_handler_.get(); 738 return audio_history_handler_.get();
739 } 739 }
740 740
741 void HotwordService::SetAudioHistoryHandler( 741 void HotwordService::SetAudioHistoryHandler(
742 HotwordAudioHistoryHandler* handler) { 742 HotwordAudioHistoryHandler* handler) {
743 audio_history_handler_.reset(handler); 743 audio_history_handler_.reset(handler);
744 } 744 }
745 745
746 void HotwordService::DisableHotwordPreferences() {
747 if (IsSometimesOnEnabled()) {
Anand Mistry (off Chromium) 2014/12/05 03:56:51 This will also disable hotwording if the user navi
rpetterson 2014/12/05 04:57:33 So if I understand correctly, you're saying only m
Anand Mistry (off Chromium) 2014/12/05 05:23:52 I think it's more nuanced than that. I think it sh
748 if (profile_->GetPrefs()->HasPrefPath(prefs::kHotwordSearchEnabled))
749 profile_->GetPrefs()->SetBoolean(prefs::kHotwordSearchEnabled, false);
750 } else if (IsAlwaysOnEnabled()) {
751 if (profile_->GetPrefs()->HasPrefPath(
752 prefs::kHotwordAlwaysOnSearchEnabled)) {
753 profile_->GetPrefs()->SetBoolean(prefs::kHotwordAlwaysOnSearchEnabled,
754 false);
755 }
756 }
757 }
758
746 void HotwordService::OnHotwordSearchEnabledChanged( 759 void HotwordService::OnHotwordSearchEnabledChanged(
747 const std::string& pref_name) { 760 const std::string& pref_name) {
748 DCHECK_EQ(pref_name, std::string(prefs::kHotwordSearchEnabled)); 761 DCHECK_EQ(pref_name, std::string(prefs::kHotwordSearchEnabled));
749 762
750 ExtensionService* extension_service = GetExtensionService(profile_); 763 ExtensionService* extension_service = GetExtensionService(profile_);
751 if (profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled)) 764 if (profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled))
752 EnableHotwordExtension(extension_service); 765 EnableHotwordExtension(extension_service);
753 else 766 else
754 DisableHotwordExtension(extension_service); 767 DisableHotwordExtension(extension_service);
755 } 768 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 HotwordPrivateEventService* event_service = 827 HotwordPrivateEventService* event_service =
815 BrowserContextKeyedAPIFactory<HotwordPrivateEventService>::Get(profile_); 828 BrowserContextKeyedAPIFactory<HotwordPrivateEventService>::Get(profile_);
816 // "enabled" isn't being changed, but piggy-back off the notification anyway. 829 // "enabled" isn't being changed, but piggy-back off the notification anyway.
817 if (event_service) 830 if (event_service)
818 event_service->OnEnabledChanged(prefs::kHotwordSearchEnabled); 831 event_service->OnEnabledChanged(prefs::kHotwordSearchEnabled);
819 } 832 }
820 833
821 bool HotwordService::UserIsActive() { 834 bool HotwordService::UserIsActive() {
822 return profile_ == ProfileManager::GetActiveUserProfile(); 835 return profile_ == ProfileManager::GetActiveUserProfile();
823 } 836 }
OLDNEW
« no previous file with comments | « chrome/browser/search/hotword_service.h ('k') | chrome/browser/ui/webui/options/browser_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698