Chromium Code Reviews| 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_controller.h" | 5 #include "chrome/browser/speech/extension_api/tts_extension_api_controller.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/float_util.h" | 10 #include "base/float_util.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 constants::kEventTypeError)); | 276 constants::kEventTypeError)); |
| 277 result_voice->Set(constants::kEventTypesKey, event_types); | 277 result_voice->Set(constants::kEventTypesKey, event_types); |
| 278 result_voices->Append(result_voice); | 278 result_voices->Append(result_voice); |
| 279 } | 279 } |
| 280 | 280 |
| 281 GetExtensionVoices(profile, result_voices); | 281 GetExtensionVoices(profile, result_voices); |
| 282 | 282 |
| 283 return result_voices; | 283 return result_voices; |
| 284 } | 284 } |
| 285 | 285 |
| 286 bool ExtensionTtsController::IsSpeaking() const { | 286 bool ExtensionTtsController::IsSpeaking() { |
| 287 return current_utterance_ != NULL; | 287 return current_utterance_ != NULL && GetPlatformImpl()->IsSpeaking(); |
|
dmazzoni
2012/04/11 20:44:18
Shouldn't this be || instead of &&
David Tseng
2012/04/11 22:20:47
On 2012/04/11 20:44:18, Dominic Mazzoni wrote:
Yo
| |
| 288 } | 288 } |
| 289 | 289 |
| 290 void ExtensionTtsController::FinishCurrentUtterance() { | 290 void ExtensionTtsController::FinishCurrentUtterance() { |
| 291 if (current_utterance_) { | 291 if (current_utterance_) { |
| 292 if (!current_utterance_->finished()) | 292 if (!current_utterance_->finished()) |
| 293 current_utterance_->OnTtsEvent(TTS_EVENT_INTERRUPTED, kInvalidCharIndex, | 293 current_utterance_->OnTtsEvent(TTS_EVENT_INTERRUPTED, kInvalidCharIndex, |
| 294 std::string()); | 294 std::string()); |
| 295 delete current_utterance_; | 295 delete current_utterance_; |
| 296 current_utterance_ = NULL; | 296 current_utterance_ = NULL; |
| 297 } | 297 } |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 327 | 327 |
| 328 int ExtensionTtsController::QueueSize() { | 328 int ExtensionTtsController::QueueSize() { |
| 329 return static_cast<int>(utterance_queue_.size()); | 329 return static_cast<int>(utterance_queue_.size()); |
| 330 } | 330 } |
| 331 | 331 |
| 332 ExtensionTtsPlatformImpl* ExtensionTtsController::GetPlatformImpl() { | 332 ExtensionTtsPlatformImpl* ExtensionTtsController::GetPlatformImpl() { |
| 333 if (!platform_impl_) | 333 if (!platform_impl_) |
| 334 platform_impl_ = ExtensionTtsPlatformImpl::GetInstance(); | 334 platform_impl_ = ExtensionTtsPlatformImpl::GetInstance(); |
| 335 return platform_impl_; | 335 return platform_impl_; |
| 336 } | 336 } |
| OLD | NEW |