OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/api/hotword_private/hotword_private_api.h" | 5 #include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 void HotwordPrivateEventService::SignalEvent(const std::string& event_name) { | 114 void HotwordPrivateEventService::SignalEvent(const std::string& event_name) { |
115 SignalEvent(event_name, make_scoped_ptr(new base::ListValue())); | 115 SignalEvent(event_name, make_scoped_ptr(new base::ListValue())); |
116 } | 116 } |
117 | 117 |
118 void HotwordPrivateEventService::SignalEvent(const std::string& event_name, | 118 void HotwordPrivateEventService::SignalEvent(const std::string& event_name, |
119 scoped_ptr<base::ListValue> args) { | 119 scoped_ptr<base::ListValue> args) { |
120 EventRouter* router = EventRouter::Get(profile_); | 120 EventRouter* router = EventRouter::Get(profile_); |
121 if (!router || !router->HasEventListener(event_name)) | 121 if (!router || !router->HasEventListener(event_name)) |
122 return; | 122 return; |
123 | 123 |
124 scoped_ptr<Event> event(new Event(event_name, args.Pass())); | 124 scoped_ptr<Event> event(new Event(events::UNKNOWN, event_name, args.Pass())); |
125 router->BroadcastEvent(event.Pass()); | 125 router->BroadcastEvent(event.Pass()); |
126 } | 126 } |
127 | 127 |
128 bool HotwordPrivateSetEnabledFunction::RunSync() { | 128 bool HotwordPrivateSetEnabledFunction::RunSync() { |
129 scoped_ptr<api::hotword_private::SetEnabled::Params> params( | 129 scoped_ptr<api::hotword_private::SetEnabled::Params> params( |
130 api::hotword_private::SetEnabled::Params::Create(*args_)); | 130 api::hotword_private::SetEnabled::Params::Create(*args_)); |
131 EXTENSION_FUNCTION_VALIDATE(params.get()); | 131 EXTENSION_FUNCTION_VALIDATE(params.get()); |
132 | 132 |
133 PrefService* prefs = GetProfile()->GetPrefs(); | 133 PrefService* prefs = GetProfile()->GetPrefs(); |
134 prefs->SetBoolean(prefs::kHotwordSearchEnabled, params->state); | 134 prefs->SetBoolean(prefs::kHotwordSearchEnabled, params->state); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 HotwordService* hotword_service = | 483 HotwordService* hotword_service = |
484 HotwordServiceFactory::GetForProfile(GetProfile()); | 484 HotwordServiceFactory::GetForProfile(GetProfile()); |
485 if (!hotword_service) | 485 if (!hotword_service) |
486 return false; | 486 return false; |
487 | 487 |
488 hotword_service->SpeakerModelExistsComplete(params->exists); | 488 hotword_service->SpeakerModelExistsComplete(params->exists); |
489 return true; | 489 return true; |
490 } | 490 } |
491 | 491 |
492 } // namespace extensions | 492 } // namespace extensions |
OLD | NEW |