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_engine_extension_api.h" | 5 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 | 183 |
184 // Add the voice name and language to the options if they're not | 184 // Add the voice name and language to the options if they're not |
185 // already there, since they might have been picked by the TTS controller | 185 // already there, since they might have been picked by the TTS controller |
186 // rather than directly by the client that requested the speech. | 186 // rather than directly by the client that requested the speech. |
187 if (!options->HasKey(constants::kVoiceNameKey)) | 187 if (!options->HasKey(constants::kVoiceNameKey)) |
188 options->SetString(constants::kVoiceNameKey, voice.name); | 188 options->SetString(constants::kVoiceNameKey, voice.name); |
189 if (!options->HasKey(constants::kLangKey)) | 189 if (!options->HasKey(constants::kLangKey)) |
190 options->SetString(constants::kLangKey, voice.lang); | 190 options->SetString(constants::kLangKey, voice.lang); |
191 | 191 |
192 args->Append(options.release()); | 192 args->Append(std::move(options)); |
193 args->AppendInteger(utterance->id()); | 193 args->AppendInteger(utterance->id()); |
194 | 194 |
195 std::string json; | 195 std::string json; |
196 base::JSONWriter::Write(*args, &json); | 196 base::JSONWriter::Write(*args, &json); |
197 | 197 |
198 std::unique_ptr<extensions::Event> event( | 198 std::unique_ptr<extensions::Event> event( |
199 new extensions::Event(extensions::events::TTS_ENGINE_ON_SPEAK, | 199 new extensions::Event(extensions::events::TTS_ENGINE_ON_SPEAK, |
200 tts_engine_events::kOnSpeak, std::move(args))); | 200 tts_engine_events::kOnSpeak, std::move(args))); |
201 Profile* profile = Profile::FromBrowserContext(utterance->browser_context()); | 201 Profile* profile = Profile::FromBrowserContext(utterance->browser_context()); |
202 event->restrict_to_browser_context = profile; | 202 event->restrict_to_browser_context = profile; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); | 327 utterance_id, TTS_EVENT_PAUSE, char_index, std::string()); |
328 } else if (event_type == constants::kEventTypeResume) { | 328 } else if (event_type == constants::kEventTypeResume) { |
329 controller->OnTtsEvent( | 329 controller->OnTtsEvent( |
330 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); | 330 utterance_id, TTS_EVENT_RESUME, char_index, std::string()); |
331 } else { | 331 } else { |
332 EXTENSION_FUNCTION_VALIDATE(false); | 332 EXTENSION_FUNCTION_VALIDATE(false); |
333 } | 333 } |
334 | 334 |
335 return true; | 335 return true; |
336 } | 336 } |
OLD | NEW |