| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/extension_tts_api_controller.h" | 5 #include "chrome/browser/extensions/extension_tts_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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 DictionaryValue* result_voice = new DictionaryValue(); | 233 DictionaryValue* result_voice = new DictionaryValue(); |
| 234 result_voice->SetString( | 234 result_voice->SetString( |
| 235 constants::kVoiceNameKey, constants::kNativeVoiceName); | 235 constants::kVoiceNameKey, constants::kNativeVoiceName); |
| 236 if (!platform_impl_->gender().empty()) | 236 if (!platform_impl_->gender().empty()) |
| 237 result_voice->SetString(constants::kGenderKey, platform_impl_->gender()); | 237 result_voice->SetString(constants::kGenderKey, platform_impl_->gender()); |
| 238 ListValue* event_types = new ListValue(); | 238 ListValue* event_types = new ListValue(); |
| 239 | 239 |
| 240 // All platforms must send end events, and cancelled and interrupted | 240 // All platforms must send end events, and cancelled and interrupted |
| 241 // events are generated from the controller. | 241 // events are generated from the controller. |
| 242 DCHECK(platform_impl_->SendsEvent(TTS_EVENT_END)); | 242 DCHECK(platform_impl_->SendsEvent(TTS_EVENT_END)); |
| 243 event_types->Append(Value::CreateStringValue(constants::kEventTypeEnd)); | 243 event_types->Append(base::StringValue::New(constants::kEventTypeEnd)); |
| 244 event_types->Append(Value::CreateStringValue( | 244 event_types->Append(base::StringValue::New( |
| 245 constants::kEventTypeCancelled)); | 245 constants::kEventTypeCancelled)); |
| 246 event_types->Append(Value::CreateStringValue( | 246 event_types->Append(base::StringValue::New( |
| 247 constants::kEventTypeInterrupted)); | 247 constants::kEventTypeInterrupted)); |
| 248 | 248 |
| 249 if (platform_impl_->SendsEvent(TTS_EVENT_START)) | 249 if (platform_impl_->SendsEvent(TTS_EVENT_START)) |
| 250 event_types->Append(Value::CreateStringValue(constants::kEventTypeStart)); | 250 event_types->Append(base::StringValue::New(constants::kEventTypeStart)); |
| 251 if (platform_impl_->SendsEvent(TTS_EVENT_WORD)) | 251 if (platform_impl_->SendsEvent(TTS_EVENT_WORD)) |
| 252 event_types->Append(Value::CreateStringValue(constants::kEventTypeWord)); | 252 event_types->Append(base::StringValue::New(constants::kEventTypeWord)); |
| 253 if (platform_impl_->SendsEvent(TTS_EVENT_SENTENCE)) | 253 if (platform_impl_->SendsEvent(TTS_EVENT_SENTENCE)) |
| 254 event_types->Append(Value::CreateStringValue( | 254 event_types->Append(base::StringValue::New( |
| 255 constants::kEventTypeSentence)); | 255 constants::kEventTypeSentence)); |
| 256 if (platform_impl_->SendsEvent(TTS_EVENT_MARKER)) | 256 if (platform_impl_->SendsEvent(TTS_EVENT_MARKER)) |
| 257 event_types->Append(Value::CreateStringValue( | 257 event_types->Append(base::StringValue::New( |
| 258 constants::kEventTypeMarker)); | 258 constants::kEventTypeMarker)); |
| 259 if (platform_impl_->SendsEvent(TTS_EVENT_ERROR)) | 259 if (platform_impl_->SendsEvent(TTS_EVENT_ERROR)) |
| 260 event_types->Append(Value::CreateStringValue( | 260 event_types->Append(base::StringValue::New( |
| 261 constants::kEventTypeError)); | 261 constants::kEventTypeError)); |
| 262 result_voice->Set(constants::kEventTypesKey, event_types); | 262 result_voice->Set(constants::kEventTypesKey, event_types); |
| 263 result_voices->Append(result_voice); | 263 result_voices->Append(result_voice); |
| 264 } | 264 } |
| 265 | 265 |
| 266 GetExtensionVoices(profile, result_voices); | 266 GetExtensionVoices(profile, result_voices); |
| 267 | 267 |
| 268 return result_voices; | 268 return result_voices; |
| 269 } | 269 } |
| 270 | 270 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 307 |
| 308 int ExtensionTtsController::QueueSize() { | 308 int ExtensionTtsController::QueueSize() { |
| 309 return static_cast<int>(utterance_queue_.size()); | 309 return static_cast<int>(utterance_queue_.size()); |
| 310 } | 310 } |
| 311 | 311 |
| 312 ExtensionTtsPlatformImpl* ExtensionTtsController::GetPlatformImpl() { | 312 ExtensionTtsPlatformImpl* ExtensionTtsController::GetPlatformImpl() { |
| 313 if (!platform_impl_) | 313 if (!platform_impl_) |
| 314 platform_impl_ = ExtensionTtsPlatformImpl::GetInstance(); | 314 platform_impl_ = ExtensionTtsPlatformImpl::GetInstance(); |
| 315 return platform_impl_; | 315 return platform_impl_; |
| 316 } | 316 } |
| OLD | NEW |