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

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

Issue 174513003: Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 3). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
« no previous file with comments | « chrome/browser/speech/extension_api/tts_extension_api.h ('k') | no next file » | 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/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/extensions/extension_function_registry.h" 12 #include "chrome/browser/extensions/extension_function_registry.h"
13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" 13 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
15 #include "chrome/browser/speech/extension_api/tts_extension_api_constants.h" 14 #include "chrome/browser/speech/extension_api/tts_extension_api_constants.h"
16 #include "chrome/browser/speech/tts_controller.h" 15 #include "chrome/browser/speech/tts_controller.h"
17 #include "extensions/browser/event_router.h" 16 #include "extensions/browser/event_router.h"
18 #include "extensions/browser/extension_system.h" 17 #include "extensions/browser/extension_system.h"
19 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
20 19
21 namespace constants = tts_extension_api_constants; 20 namespace constants = tts_extension_api_constants;
22 21
23 namespace events { 22 namespace events {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 334 }
336 result_voice->Set(constants::kEventTypesKey, event_types); 335 result_voice->Set(constants::kEventTypesKey, event_types);
337 336
338 result_voices->Append(result_voice); 337 result_voices->Append(result_voice);
339 } 338 }
340 339
341 SetResult(result_voices.release()); 340 SetResult(result_voices.release());
342 return true; 341 return true;
343 } 342 }
344 343
345 // static 344 TtsAPI::TtsAPI(content::BrowserContext* context) {
346 TtsAPI* TtsAPI::Get(Profile* profile) {
347 return ProfileKeyedAPIFactory<TtsAPI>::GetForProfile(profile);
348 }
349
350 TtsAPI::TtsAPI(Profile* profile) {
351 ExtensionFunctionRegistry* registry = 345 ExtensionFunctionRegistry* registry =
352 ExtensionFunctionRegistry::GetInstance(); 346 ExtensionFunctionRegistry::GetInstance();
353 registry->RegisterFunction<ExtensionTtsEngineSendTtsEventFunction>(); 347 registry->RegisterFunction<ExtensionTtsEngineSendTtsEventFunction>();
354 registry->RegisterFunction<TtsGetVoicesFunction>(); 348 registry->RegisterFunction<TtsGetVoicesFunction>();
355 registry->RegisterFunction<TtsIsSpeakingFunction>(); 349 registry->RegisterFunction<TtsIsSpeakingFunction>();
356 registry->RegisterFunction<TtsSpeakFunction>(); 350 registry->RegisterFunction<TtsSpeakFunction>();
357 registry->RegisterFunction<TtsStopSpeakingFunction>(); 351 registry->RegisterFunction<TtsStopSpeakingFunction>();
358 registry->RegisterFunction<TtsPauseFunction>(); 352 registry->RegisterFunction<TtsPauseFunction>();
359 registry->RegisterFunction<TtsResumeFunction>(); 353 registry->RegisterFunction<TtsResumeFunction>();
360 } 354 }
361 355
362 TtsAPI::~TtsAPI() { 356 TtsAPI::~TtsAPI() {
363 } 357 }
364 358
365 static base::LazyInstance<ProfileKeyedAPIFactory<TtsAPI> > 359 static base::LazyInstance<ProfileKeyedAPIFactory<TtsAPI> >
366 g_factory = LAZY_INSTANCE_INITIALIZER; 360 g_factory = LAZY_INSTANCE_INITIALIZER;
367 361
368 ProfileKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() { 362 ProfileKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() {
369 return g_factory.Pointer(); 363 return g_factory.Pointer();
370 } 364 }
371 365
372 } // namespace extensions 366 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/speech/extension_api/tts_extension_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698