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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 void GetExtensionVoices(Profile* profile, std::vector<VoiceData>* out_voices) { | 61 void GetExtensionVoices(Profile* profile, std::vector<VoiceData>* out_voices) { |
62 ExtensionService* service = profile->GetExtensionService(); | 62 ExtensionService* service = profile->GetExtensionService(); |
63 DCHECK(service); | 63 DCHECK(service); |
64 EventRouter* event_router = | 64 EventRouter* event_router = |
65 ExtensionSystem::Get(profile)->event_router(); | 65 ExtensionSystem::Get(profile)->event_router(); |
66 DCHECK(event_router); | 66 DCHECK(event_router); |
67 | 67 |
68 const ExtensionSet* extensions = service->extensions(); | 68 const ExtensionSet* extensions = service->extensions(); |
69 ExtensionSet::const_iterator iter; | 69 ExtensionSet::const_iterator iter; |
70 for (iter = extensions->begin(); iter != extensions->end(); ++iter) { | 70 for (iter = extensions->begin(); iter != extensions->end(); ++iter) { |
71 const Extension* extension = *iter; | 71 const Extension* extension = iter->get(); |
72 | 72 |
73 if (!event_router->ExtensionHasEventListener( | 73 if (!event_router->ExtensionHasEventListener( |
74 extension->id(), tts_engine_events::kOnSpeak) || | 74 extension->id(), tts_engine_events::kOnSpeak) || |
75 !event_router->ExtensionHasEventListener( | 75 !event_router->ExtensionHasEventListener( |
76 extension->id(), tts_engine_events::kOnStop)) { | 76 extension->id(), tts_engine_events::kOnStop)) { |
77 continue; | 77 continue; |
78 } | 78 } |
79 | 79 |
80 const std::vector<extensions::TtsVoice>* tts_voices = | 80 const std::vector<extensions::TtsVoice>* tts_voices = |
81 extensions::TtsVoice::GetTtsVoices(extension); | 81 extensions::TtsVoice::GetTtsVoices(extension); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); | 252 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); |
253 } else if (event_type == constants::kEventTypeResume) { | 253 } else if (event_type == constants::kEventTypeResume) { |
254 controller->OnTtsEvent( | 254 controller->OnTtsEvent( |
255 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); | 255 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); |
256 } else { | 256 } else { |
257 EXTENSION_FUNCTION_VALIDATE(false); | 257 EXTENSION_FUNCTION_VALIDATE(false); |
258 } | 258 } |
259 | 259 |
260 return true; | 260 return true; |
261 } | 261 } |
OLD | NEW |