| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/speech/extension_api/tts_engine_extension_api.h" | 5 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 scoped_ptr<extensions::Event> event(new extensions::Event( | 196 scoped_ptr<extensions::Event> event(new extensions::Event( |
| 197 tts_engine_events::kOnResume, args.Pass())); | 197 tts_engine_events::kOnResume, args.Pass())); |
| 198 Profile* profile = utterance->profile(); | 198 Profile* profile = utterance->profile(); |
| 199 event->restrict_to_browser_context = profile; | 199 event->restrict_to_browser_context = profile; |
| 200 EventRouter* event_router = EventRouter::Get(profile); | 200 EventRouter* event_router = EventRouter::Get(profile); |
| 201 std::string id = utterance->extension_id(); | 201 std::string id = utterance->extension_id(); |
| 202 event_router->DispatchEventToExtension(id, event.Pass()); | 202 event_router->DispatchEventToExtension(id, event.Pass()); |
| 203 WarnIfMissingPauseOrResumeListener(profile, event_router, id); | 203 WarnIfMissingPauseOrResumeListener(profile, event_router, id); |
| 204 } | 204 } |
| 205 | 205 |
| 206 bool ExtensionTtsEngineSendTtsEventFunction::RunImpl() { | 206 bool ExtensionTtsEngineSendTtsEventFunction::RunSync() { |
| 207 int utterance_id; | 207 int utterance_id; |
| 208 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &utterance_id)); | 208 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &utterance_id)); |
| 209 | 209 |
| 210 base::DictionaryValue* event; | 210 base::DictionaryValue* event; |
| 211 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &event)); | 211 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &event)); |
| 212 | 212 |
| 213 std::string event_type; | 213 std::string event_type; |
| 214 EXTENSION_FUNCTION_VALIDATE( | 214 EXTENSION_FUNCTION_VALIDATE( |
| 215 event->GetString(constants::kEventTypeKey, &event_type)); | 215 event->GetString(constants::kEventTypeKey, &event_type)); |
| 216 | 216 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); | 268 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); |
| 269 } else if (event_type == constants::kEventTypeResume) { | 269 } else if (event_type == constants::kEventTypeResume) { |
| 270 controller->OnTtsEvent( | 270 controller->OnTtsEvent( |
| 271 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); | 271 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); |
| 272 } else { | 272 } else { |
| 273 EXTENSION_FUNCTION_VALIDATE(false); | 273 EXTENSION_FUNCTION_VALIDATE(false); |
| 274 } | 274 } |
| 275 | 275 |
| 276 return true; | 276 return true; |
| 277 } | 277 } |
| OLD | NEW |