Commit 04386e72 authored by dmazzoni@chromium.org's avatar dmazzoni@chromium.org

Fix a bug in the TTS extension API where the getVoices function wouldn't

return a native voice if no other extension API functions had been called,
due to accessing a variable that's supposed to be initialized on demand.

BUG=93642
TEST=manual testing


Review URL: http://codereview.chromium.org/7686018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97730 0039d316-1c4b-4281-b951-d872f2087c98
parent 1dcae067
......@@ -229,34 +229,35 @@ void ExtensionTtsController::OnTtsEvent(int utterance_id,
ListValue* ExtensionTtsController::GetVoices(Profile* profile) {
ListValue* result_voices = new ListValue();
if (platform_impl_ && platform_impl_->PlatformImplAvailable()) {
ExtensionTtsPlatformImpl* platform_impl = GetPlatformImpl();
if (platform_impl && platform_impl->PlatformImplAvailable()) {
DictionaryValue* result_voice = new DictionaryValue();
result_voice->SetString(
constants::kVoiceNameKey, constants::kNativeVoiceName);
if (!platform_impl_->gender().empty())
result_voice->SetString(constants::kGenderKey, platform_impl_->gender());
if (!platform_impl->gender().empty())
result_voice->SetString(constants::kGenderKey, platform_impl->gender());
ListValue* event_types = new ListValue();
// All platforms must send end events, and cancelled and interrupted
// events are generated from the controller.
DCHECK(platform_impl_->SendsEvent(TTS_EVENT_END));
DCHECK(platform_impl->SendsEvent(TTS_EVENT_END));
event_types->Append(Value::CreateStringValue(constants::kEventTypeEnd));
event_types->Append(Value::CreateStringValue(
constants::kEventTypeCancelled));
event_types->Append(Value::CreateStringValue(
constants::kEventTypeInterrupted));
if (platform_impl_->SendsEvent(TTS_EVENT_START))
if (platform_impl->SendsEvent(TTS_EVENT_START))
event_types->Append(Value::CreateStringValue(constants::kEventTypeStart));
if (platform_impl_->SendsEvent(TTS_EVENT_WORD))
if (platform_impl->SendsEvent(TTS_EVENT_WORD))
event_types->Append(Value::CreateStringValue(constants::kEventTypeWord));
if (platform_impl_->SendsEvent(TTS_EVENT_SENTENCE))
if (platform_impl->SendsEvent(TTS_EVENT_SENTENCE))
event_types->Append(Value::CreateStringValue(
constants::kEventTypeSentence));
if (platform_impl_->SendsEvent(TTS_EVENT_MARKER))
if (platform_impl->SendsEvent(TTS_EVENT_MARKER))
event_types->Append(Value::CreateStringValue(
constants::kEventTypeMarker));
if (platform_impl_->SendsEvent(TTS_EVENT_ERROR))
if (platform_impl->SendsEvent(TTS_EVENT_ERROR))
event_types->Append(Value::CreateStringValue(
constants::kEventTypeError));
result_voice->Set(constants::kEventTypesKey, event_types);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment