Chromium Code Reviews| 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)) |