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

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

Issue 1027683002: Hotword Private API: Add function and event to query the existence of a speaker model (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Upload remaining test files 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 side-by-side diff with in-line comments
Download patch
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 04e032b9646e442d607e52f8a976e11a40f786c0..04c16a6bc35672380f727878e4861c5e5fa04bb0 100644
--- a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
+++ b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
@@ -102,6 +102,10 @@ void HotwordPrivateEventService::OnDeleteSpeakerModel() {
SignalEvent(api::hotword_private::OnDeleteSpeakerModel::kEventName);
}
+void HotwordPrivateEventService::OnSpeakerModelExists() {
+ SignalEvent(api::hotword_private::OnSpeakerModelExists::kEventName);
+}
+
void HotwordPrivateEventService::SignalEvent(const std::string& event_name) {
EventRouter* router = EventRouter::Get(profile_);
if (!router || !router->HasEventListener(event_name))
@@ -462,4 +466,18 @@ void HotwordPrivateGetAudioHistoryEnabledFunction::SetResultAndSendResponse(
SendResponse(true);
}
+bool HotwordPrivateSpeakerModelExistsResultFunction::RunSync() {
+ scoped_ptr<api::hotword_private::SpeakerModelExistsResult::Params> params(
+ api::hotword_private::SpeakerModelExistsResult::Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params.get());
+
+ HotwordService* hotword_service =
+ HotwordServiceFactory::GetForProfile(GetProfile());
+ if (!hotword_service)
+ return false;
+
+ hotword_service->SpeakerModelExistsComplete(params->exists);
+ return true;
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698