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

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

Issue 1047973003: Notify hotwording extension of microphone state change. (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 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 d38013a83fd14dcef5528c3625214ee2a6957546..a1c46611fecd5b06d7deccbdd8f7d9bcdd306417 100644
--- a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
+++ b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
@@ -106,6 +106,16 @@ void HotwordPrivateEventService::OnSpeakerModelExists() {
SignalEvent(api::hotword_private::OnSpeakerModelExists::kEventName);
}
+void HotwordPrivateEventService::OnMicrophoneStateChanged(bool enabled) {
+ EventRouter* router = EventRouter::Get(profile_);
kcarattini 2015/03/31 23:31:46 check for a null return value (like the function b
calamity 2015/04/01 02:36:10 Made an overload for SignalEvent.
kcarattini 2015/04/01 05:04:36 Even better.
+
+ scoped_ptr<base::ListValue> args(new base::ListValue());
+ args->AppendBoolean(enabled);
+ scoped_ptr<Event> event(new Event(
+ api::hotword_private::OnMicrophoneStateChanged::kEventName, args.Pass()));
+ router->BroadcastEvent(event.Pass());
+}
+
void HotwordPrivateEventService::SignalEvent(const std::string& event_name) {
EventRouter* router = EventRouter::Get(profile_);
if (!router || !router->HasEventListener(event_name))

Powered by Google App Engine
This is Rietveld 408576698