Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: chrome/browser/speech/extension_api/tts_engine_extension_api.cc

Issue 372103006: Stamp out CreateStringValue in chrome/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 } 128 }
129 129
130 void ExtensionTtsEngineSpeak(Utterance* utterance, const VoiceData& voice) { 130 void ExtensionTtsEngineSpeak(Utterance* utterance, const VoiceData& voice) {
131 // See if the engine supports the "end" event; if so, we can keep the 131 // See if the engine supports the "end" event; if so, we can keep the
132 // utterance around and track it. If not, we're finished with this 132 // utterance around and track it. If not, we're finished with this
133 // utterance now. 133 // utterance now.
134 bool sends_end_event = voice.events.find(TTS_EVENT_END) != voice.events.end(); 134 bool sends_end_event = voice.events.find(TTS_EVENT_END) != voice.events.end();
135 135
136 scoped_ptr<base::ListValue> args(new base::ListValue()); 136 scoped_ptr<base::ListValue> args(new base::ListValue());
137 args->Set(0, base::Value::CreateStringValue(utterance->text())); 137 args->Set(0, new base::StringValue(utterance->text()));
138 138
139 // Pass through most options to the speech engine, but remove some 139 // Pass through most options to the speech engine, but remove some
140 // that are handled internally. 140 // that are handled internally.
141 scoped_ptr<base::DictionaryValue> options(static_cast<base::DictionaryValue*>( 141 scoped_ptr<base::DictionaryValue> options(static_cast<base::DictionaryValue*>(
142 utterance->options()->DeepCopy())); 142 utterance->options()->DeepCopy()));
143 if (options->HasKey(constants::kRequiredEventTypesKey)) 143 if (options->HasKey(constants::kRequiredEventTypesKey))
144 options->Remove(constants::kRequiredEventTypesKey, NULL); 144 options->Remove(constants::kRequiredEventTypesKey, NULL);
145 if (options->HasKey(constants::kDesiredEventTypesKey)) 145 if (options->HasKey(constants::kDesiredEventTypesKey))
146 options->Remove(constants::kDesiredEventTypesKey, NULL); 146 options->Remove(constants::kDesiredEventTypesKey, NULL);
147 if (sends_end_event && options->HasKey(constants::kEnqueueKey)) 147 if (sends_end_event && options->HasKey(constants::kEnqueueKey))
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); 269 utterance_id, TTS_EVENT_PAUSE, char_index, std::string());
270 } else if (event_type == constants::kEventTypeResume) { 270 } else if (event_type == constants::kEventTypeResume) {
271 controller->OnTtsEvent( 271 controller->OnTtsEvent(
272 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); 272 utterance_id, TTS_EVENT_RESUME, char_index, std::string());
273 } else { 273 } else {
274 EXTENSION_FUNCTION_VALIDATE(false); 274 EXTENSION_FUNCTION_VALIDATE(false);
275 } 275 }
276 276
277 return true; 277 return true;
278 } 278 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698