| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void GetExtensionVoices(Profile* profile, std::vector<VoiceData>* out_voices) { | 62 void GetExtensionVoices(Profile* profile, std::vector<VoiceData>* out_voices) { |
| 63 ExtensionService* service = profile->GetExtensionService(); | 63 ExtensionService* service = profile->GetExtensionService(); |
| 64 DCHECK(service); | 64 DCHECK(service); |
| 65 EventRouter* event_router = | 65 EventRouter* event_router = |
| 66 ExtensionSystem::Get(profile)->event_router(); | 66 ExtensionSystem::Get(profile)->event_router(); |
| 67 DCHECK(event_router); | 67 DCHECK(event_router); |
| 68 | 68 |
| 69 bool is_offline = (net::NetworkChangeNotifier::GetConnectionType() == | 69 bool is_offline = (net::NetworkChangeNotifier::GetConnectionType() == |
| 70 net::NetworkChangeNotifier::CONNECTION_NONE); | 70 net::NetworkChangeNotifier::CONNECTION_NONE); |
| 71 | 71 |
| 72 const ExtensionSet* extensions = service->extensions(); | 72 const extensions::ExtensionSet* extensions = service->extensions(); |
| 73 ExtensionSet::const_iterator iter; | 73 extensions::ExtensionSet::const_iterator iter; |
| 74 for (iter = extensions->begin(); iter != extensions->end(); ++iter) { | 74 for (iter = extensions->begin(); iter != extensions->end(); ++iter) { |
| 75 const Extension* extension = iter->get(); | 75 const Extension* extension = iter->get(); |
| 76 | 76 |
| 77 if (!event_router->ExtensionHasEventListener( | 77 if (!event_router->ExtensionHasEventListener( |
| 78 extension->id(), tts_engine_events::kOnSpeak) || | 78 extension->id(), tts_engine_events::kOnSpeak) || |
| 79 !event_router->ExtensionHasEventListener( | 79 !event_router->ExtensionHasEventListener( |
| 80 extension->id(), tts_engine_events::kOnStop)) { | 80 extension->id(), tts_engine_events::kOnStop)) { |
| 81 continue; | 81 continue; |
| 82 } | 82 } |
| 83 | 83 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); | 260 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); |
| 261 } else if (event_type == constants::kEventTypeResume) { | 261 } else if (event_type == constants::kEventTypeResume) { |
| 262 controller->OnTtsEvent( | 262 controller->OnTtsEvent( |
| 263 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); | 263 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); |
| 264 } else { | 264 } else { |
| 265 EXTENSION_FUNCTION_VALIDATE(false); | 265 EXTENSION_FUNCTION_VALIDATE(false); |
| 266 } | 266 } |
| 267 | 267 |
| 268 return true; | 268 return true; |
| 269 } | 269 } |
| OLD | NEW |