| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 extensions::ProcessManager::Get(profile) | 58 extensions::ProcessManager::Get(profile) |
| 59 ->GetBackgroundHostForExtension(extension_id); | 59 ->GetBackgroundHostForExtension(extension_id); |
| 60 host->host_contents()->GetMainFrame()->AddMessageToConsole( | 60 host->host_contents()->GetMainFrame()->AddMessageToConsole( |
| 61 content::CONSOLE_MESSAGE_LEVEL_WARNING, | 61 content::CONSOLE_MESSAGE_LEVEL_WARNING, |
| 62 constants::kErrorMissingPauseOrResume); | 62 constants::kErrorMissingPauseOrResume); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 TtsExtensionEngine* TtsExtensionEngine::GetInstance() { | 67 TtsExtensionEngine* TtsExtensionEngine::GetInstance() { |
| 68 return Singleton<TtsExtensionEngine>::get(); | 68 return base::Singleton<TtsExtensionEngine>::get(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void TtsExtensionEngine::GetVoices(content::BrowserContext* browser_context, | 71 void TtsExtensionEngine::GetVoices(content::BrowserContext* browser_context, |
| 72 std::vector<VoiceData>* out_voices) { | 72 std::vector<VoiceData>* out_voices) { |
| 73 Profile* profile = Profile::FromBrowserContext(browser_context); | 73 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 74 EventRouter* event_router = EventRouter::Get(profile); | 74 EventRouter* event_router = EventRouter::Get(profile); |
| 75 DCHECK(event_router); | 75 DCHECK(event_router); |
| 76 | 76 |
| 77 bool is_offline = (net::NetworkChangeNotifier::GetConnectionType() == | 77 bool is_offline = (net::NetworkChangeNotifier::GetConnectionType() == |
| 78 net::NetworkChangeNotifier::CONNECTION_NONE); | 78 net::NetworkChangeNotifier::CONNECTION_NONE); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); | 324 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); |
| 325 } else if (event_type == constants::kEventTypeResume) { | 325 } else if (event_type == constants::kEventTypeResume) { |
| 326 controller->OnTtsEvent( | 326 controller->OnTtsEvent( |
| 327 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); | 327 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); |
| 328 } else { | 328 } else { |
| 329 EXTENSION_FUNCTION_VALIDATE(false); | 329 EXTENSION_FUNCTION_VALIDATE(false); |
| 330 } | 330 } |
| 331 | 331 |
| 332 return true; | 332 return true; |
| 333 } | 333 } |
| OLD | NEW |