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

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

Issue 1014143003: Change set_continuous_parameters() for removing duplicated behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/speech/tts_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_extension_api.h" 5 #include "chrome/browser/speech/extension_api/tts_extension_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 EXTENSION_FUNCTION_VALIDATE( 262 EXTENSION_FUNCTION_VALIDATE(
263 options->GetInteger(constants::kSrcIdKey, &src_id)); 263 options->GetInteger(constants::kSrcIdKey, &src_id));
264 } 264 }
265 265
266 // If we got this far, the arguments were all in the valid format, so 266 // If we got this far, the arguments were all in the valid format, so
267 // send the success response to the callback now - this ensures that 267 // send the success response to the callback now - this ensures that
268 // the callback response always arrives before events, which makes 268 // the callback response always arrives before events, which makes
269 // the behavior more predictable and easier to write unit tests for too. 269 // the behavior more predictable and easier to write unit tests for too.
270 SendResponse(true); 270 SendResponse(true);
271 271
272 UtteranceContinuousParameters continuous_params;
273 continuous_params.rate = rate;
274 continuous_params.pitch = pitch;
275 continuous_params.volume = volume;
276
277 Utterance* utterance = new Utterance(GetProfile()); 272 Utterance* utterance = new Utterance(GetProfile());
278 utterance->set_text(text); 273 utterance->set_text(text);
279 utterance->set_voice_name(voice_name); 274 utterance->set_voice_name(voice_name);
280 utterance->set_src_id(src_id); 275 utterance->set_src_id(src_id);
281 utterance->set_src_url(source_url()); 276 utterance->set_src_url(source_url());
282 utterance->set_lang(lang); 277 utterance->set_lang(lang);
283 utterance->set_gender(gender); 278 utterance->set_gender(gender);
284 utterance->set_continuous_parameters(continuous_params); 279 utterance->set_continuous_parameters(rate, pitch, volume);
285 utterance->set_can_enqueue(can_enqueue); 280 utterance->set_can_enqueue(can_enqueue);
286 utterance->set_required_event_types(required_event_types); 281 utterance->set_required_event_types(required_event_types);
287 utterance->set_desired_event_types(desired_event_types); 282 utterance->set_desired_event_types(desired_event_types);
288 utterance->set_extension_id(voice_extension_id); 283 utterance->set_extension_id(voice_extension_id);
289 utterance->set_options(options.get()); 284 utterance->set_options(options.get());
290 utterance->set_event_delegate(new TtsExtensionEventHandler(extension_id())); 285 utterance->set_event_delegate(new TtsExtensionEventHandler(extension_id()));
291 286
292 TtsController* controller = TtsController::GetInstance(); 287 TtsController* controller = TtsController::GetInstance();
293 controller->SpeakOrEnqueue(utterance); 288 controller->SpeakOrEnqueue(utterance);
294 return true; 289 return true;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 363 }
369 364
370 static base::LazyInstance<BrowserContextKeyedAPIFactory<TtsAPI> > g_factory = 365 static base::LazyInstance<BrowserContextKeyedAPIFactory<TtsAPI> > g_factory =
371 LAZY_INSTANCE_INITIALIZER; 366 LAZY_INSTANCE_INITIALIZER;
372 367
373 BrowserContextKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() { 368 BrowserContextKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() {
374 return g_factory.Pointer(); 369 return g_factory.Pointer();
375 } 370 }
376 371
377 } // namespace extensions 372 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/speech/tts_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698