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

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

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // rather than directly by the client that requested the speech. 184 // rather than directly by the client that requested the speech.
185 if (!options->HasKey(constants::kVoiceNameKey)) 185 if (!options->HasKey(constants::kVoiceNameKey))
186 options->SetString(constants::kVoiceNameKey, voice.name); 186 options->SetString(constants::kVoiceNameKey, voice.name);
187 if (!options->HasKey(constants::kLangKey)) 187 if (!options->HasKey(constants::kLangKey))
188 options->SetString(constants::kLangKey, voice.lang); 188 options->SetString(constants::kLangKey, voice.lang);
189 189
190 args->Append(options.release()); 190 args->Append(options.release());
191 args->AppendInteger(utterance->id()); 191 args->AppendInteger(utterance->id());
192 192
193 std::string json; 193 std::string json;
194 base::JSONWriter::Write(args.get(), &json); 194 base::JSONWriter::Write(*args, &json);
195 195
196 scoped_ptr<extensions::Event> event(new extensions::Event( 196 scoped_ptr<extensions::Event> event(new extensions::Event(
197 tts_engine_events::kOnSpeak, args.Pass())); 197 tts_engine_events::kOnSpeak, args.Pass()));
198 Profile* profile = Profile::FromBrowserContext(utterance->browser_context()); 198 Profile* profile = Profile::FromBrowserContext(utterance->browser_context());
199 event->restrict_to_browser_context = profile; 199 event->restrict_to_browser_context = profile;
200 EventRouter::Get(profile) 200 EventRouter::Get(profile)
201 ->DispatchEventToExtension(utterance->extension_id(), event.Pass()); 201 ->DispatchEventToExtension(utterance->extension_id(), event.Pass());
202 } 202 }
203 203
204 void TtsExtensionEngine::Stop(Utterance* utterance) { 204 void TtsExtensionEngine::Stop(Utterance* utterance) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); 321 utterance_id, TTS_EVENT_PAUSE, char_index, std::string());
322 } else if (event_type == constants::kEventTypeResume) { 322 } else if (event_type == constants::kEventTypeResume) {
323 controller->OnTtsEvent( 323 controller->OnTtsEvent(
324 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); 324 utterance_id, TTS_EVENT_RESUME, char_index, std::string());
325 } else { 325 } else {
326 EXTENSION_FUNCTION_VALIDATE(false); 326 EXTENSION_FUNCTION_VALIDATE(false);
327 } 327 }
328 328
329 return true; 329 return true;
330 } 330 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_json_parser_browsertest.cc ('k') | chrome/browser/spellchecker/feedback_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698