| 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_extension_api_chromeos.h" | 5 #include "chrome/browser/speech/extension_api/tts_extension_api_chromeos.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual bool Speak( | 42 virtual bool Speak( |
| 43 int utterance_id, | 43 int utterance_id, |
| 44 const std::string& utterance, | 44 const std::string& utterance, |
| 45 const std::string& lang, | 45 const std::string& lang, |
| 46 const UtteranceContinuousParameters& params); | 46 const UtteranceContinuousParameters& params); |
| 47 | 47 |
| 48 virtual bool StopSpeaking(); | 48 virtual bool StopSpeaking(); |
| 49 | 49 |
| 50 virtual bool IsSpeaking(); |
| 51 |
| 50 virtual bool SendsEvent(TtsEventType event_type); | 52 virtual bool SendsEvent(TtsEventType event_type); |
| 51 | 53 |
| 52 // Get the single instance of this class. | 54 // Get the single instance of this class. |
| 53 static ExtensionTtsPlatformImplChromeOs* GetInstance(); | 55 static ExtensionTtsPlatformImplChromeOs* GetInstance(); |
| 54 | 56 |
| 55 // TTS won't begin until this is called. | 57 // TTS won't begin until this is called. |
| 56 void Enable(); | 58 void Enable(); |
| 57 | 59 |
| 58 private: | 60 private: |
| 59 ExtensionTtsPlatformImplChromeOs(); | 61 ExtensionTtsPlatformImplChromeOs(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 if (!enabled_) { | 158 if (!enabled_) { |
| 157 STLDeleteElements(&queued_utterances_); | 159 STLDeleteElements(&queued_utterances_); |
| 158 return true; | 160 return true; |
| 159 } | 161 } |
| 160 | 162 |
| 161 chromeos::DBusThreadManager::Get()->GetSpeechSynthesizerClient()-> | 163 chromeos::DBusThreadManager::Get()->GetSpeechSynthesizerClient()-> |
| 162 StopSpeaking(); | 164 StopSpeaking(); |
| 163 return true; | 165 return true; |
| 164 } | 166 } |
| 165 | 167 |
| 168 bool ExtensionTtsPlatformImplChromeOs::IsSpeaking() { |
| 169 // Defers to controller's utterance based detection of is speaking. |
| 170 return true; |
| 171 } |
| 172 |
| 166 bool ExtensionTtsPlatformImplChromeOs::SendsEvent(TtsEventType event_type) { | 173 bool ExtensionTtsPlatformImplChromeOs::SendsEvent(TtsEventType event_type) { |
| 167 return (event_type == TTS_EVENT_START || | 174 return (event_type == TTS_EVENT_START || |
| 168 event_type == TTS_EVENT_END || | 175 event_type == TTS_EVENT_END || |
| 169 event_type == TTS_EVENT_ERROR); | 176 event_type == TTS_EVENT_ERROR); |
| 170 } | 177 } |
| 171 | 178 |
| 172 void ExtensionTtsPlatformImplChromeOs::Enable() { | 179 void ExtensionTtsPlatformImplChromeOs::Enable() { |
| 173 enabled_ = true; | 180 enabled_ = true; |
| 174 while (!queued_utterances_.empty()) { | 181 while (!queued_utterances_.empty()) { |
| 175 QueuedUtterance* queued = queued_utterances_.front(); | 182 QueuedUtterance* queued = queued_utterances_.front(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 // static | 237 // static |
| 231 ExtensionTtsPlatformImplChromeOs* | 238 ExtensionTtsPlatformImplChromeOs* |
| 232 ExtensionTtsPlatformImplChromeOs::GetInstance() { | 239 ExtensionTtsPlatformImplChromeOs::GetInstance() { |
| 233 return Singleton<ExtensionTtsPlatformImplChromeOs>::get(); | 240 return Singleton<ExtensionTtsPlatformImplChromeOs>::get(); |
| 234 } | 241 } |
| 235 | 242 |
| 236 // global | 243 // global |
| 237 void EnableChromeOsTts() { | 244 void EnableChromeOsTts() { |
| 238 ExtensionTtsPlatformImplChromeOs::GetInstance()->Enable(); | 245 ExtensionTtsPlatformImplChromeOs::GetInstance()->Enable(); |
| 239 } | 246 } |
| OLD | NEW |