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

Unified Diff: chrome/browser/extensions/api/hotword_private/hotword_private_api.cc

Issue 555423002: Expose always-on hotword preference via hotwordPrivate API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/hotword_private/hotword_private_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
diff --git a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
index 53f6170c75725d14147381f8c49cc5dd86482d9c..c2204546421f2400d5f8b425c659d34d636e4353 100644
--- a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
+++ b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
@@ -32,6 +32,10 @@ HotwordPrivateEventService::HotwordPrivateEventService(
prefs::kHotwordSearchEnabled,
base::Bind(&HotwordPrivateEventService::OnEnabledChanged,
base::Unretained(this)));
+ pref_change_registrar_.Add(
+ prefs::kHotwordAlwaysOnSearchEnabled,
+ base::Bind(&HotwordPrivateEventService::OnEnabledChanged,
+ base::Unretained(this)));
}
HotwordPrivateEventService::~HotwordPrivateEventService() {
@@ -53,7 +57,8 @@ const char* HotwordPrivateEventService::service_name() {
void HotwordPrivateEventService::OnEnabledChanged(
const std::string& pref_name) {
- DCHECK_EQ(pref_name, std::string(prefs::kHotwordSearchEnabled));
+ DCHECK(pref_name == std::string(prefs::kHotwordSearchEnabled) ||
+ pref_name == std::string(prefs::kHotwordAlwaysOnSearchEnabled));
SignalEvent(OnEnabledChanged::kEventName);
}
@@ -107,6 +112,8 @@ bool HotwordPrivateGetStatusFunction::RunSync() {
PrefService* prefs = GetProfile()->GetPrefs();
result.enabled_set = prefs->HasPrefPath(prefs::kHotwordSearchEnabled);
result.enabled = prefs->GetBoolean(prefs::kHotwordSearchEnabled);
+ result.always_on_enabled =
+ prefs->GetBoolean(prefs::kHotwordAlwaysOnSearchEnabled);
result.audio_logging_enabled = false;
CommandLine* command_line = CommandLine::ForCurrentProcess();
result.experimental_hotword_enabled = command_line->HasSwitch(
« no previous file with comments | « no previous file | chrome/browser/extensions/api/hotword_private/hotword_private_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698