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

Side by Side Diff: chrome/browser/speech/tts_chromeos.cc

Issue 361363003: Support onvoiceschanged for extension-based tts engines. (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/tts_extension_loader_chromeos.h" 5 #include "chrome/browser/extensions/component_loader.h"
6 #include "chrome/browser/extensions/extension_service.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/speech/tts_engine_extension_observer.h"
6 #include "chrome/browser/speech/tts_platform.h" 9 #include "chrome/browser/speech/tts_platform.h"
10 #include "chrome/common/extensions/extension_constants.h"
11 #include "extensions/browser/extension_system.h"
7 12
8 // Chrome OS doesn't have native TTS, instead it includes a built-in 13 // Chrome OS doesn't have native TTS, instead it includes a built-in
9 // component extension that provides speech synthesis. This class includes 14 // component extension that provides speech synthesis. This class includes
10 // an implementation of LoadBuiltInTtsExtension and dummy implementations of 15 // an implementation of LoadBuiltInTtsExtension and dummy implementations of
11 // everything else. 16 // everything else.
12 class TtsPlatformImplChromeOs 17 class TtsPlatformImplChromeOs
13 : public TtsPlatformImpl { 18 : public TtsPlatformImpl {
14 public: 19 public:
15 // TtsPlatformImpl overrides: 20 // TtsPlatformImpl overrides:
16 virtual bool PlatformImplAvailable() OVERRIDE { 21 virtual bool PlatformImplAvailable() OVERRIDE {
17 return false; 22 return false;
18 } 23 }
19 24
20 virtual bool LoadBuiltInTtsExtension(Profile* profile) OVERRIDE { 25 virtual bool LoadBuiltInTtsExtension(Profile* profile) OVERRIDE {
21 return TtsExtensionLoaderChromeOs::GetInstance(profile)->LoadTtsExtension(); 26 // Check to see if the engine was previously loaded.
27 if (TtsEngineExtensionObserver::GetInstance(profile)->SawExtensionLoad(
28 extension_misc::kSpeechSynthesisExtensionId, true)) {
29 return false;
30 }
31
32 // Load the component extension into this profile.
33 ExtensionService* extension_service =
34 extensions::ExtensionSystem::Get(profile)->extension_service();
35 DCHECK(extension_service);
36 extension_service->component_loader()
37 ->AddChromeOsSpeechSynthesisExtension();
38 return true;
22 } 39 }
23 40
24 virtual bool Speak( 41 virtual bool Speak(
25 int utterance_id, 42 int utterance_id,
26 const std::string& utterance, 43 const std::string& utterance,
27 const std::string& lang, 44 const std::string& lang,
28 const VoiceData& voice, 45 const VoiceData& voice,
29 const UtteranceContinuousParameters& params) OVERRIDE { 46 const UtteranceContinuousParameters& params) OVERRIDE {
30 return false; 47 return false;
31 } 48 }
(...skipping 28 matching lines...) Expand all
60 // static 77 // static
61 TtsPlatformImpl* TtsPlatformImpl::GetInstance() { 78 TtsPlatformImpl* TtsPlatformImpl::GetInstance() {
62 return TtsPlatformImplChromeOs::GetInstance(); 79 return TtsPlatformImplChromeOs::GetInstance();
63 } 80 }
64 81
65 // static 82 // static
66 TtsPlatformImplChromeOs* 83 TtsPlatformImplChromeOs*
67 TtsPlatformImplChromeOs::GetInstance() { 84 TtsPlatformImplChromeOs::GetInstance() {
68 return Singleton<TtsPlatformImplChromeOs>::get(); 85 return Singleton<TtsPlatformImplChromeOs>::get();
69 } 86 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/speech/tts_controller.cc » ('j') | chrome/browser/speech/tts_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698