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

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

Issue 188633003: Revert of Eliminate the dependence of tts extension API for tts_controller.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 | « AUTHORS ('k') | chrome/browser/speech/extension_api/tts_engine_extension_api.cc » ('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 #ifndef CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_ 5 #ifndef CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_
6 #define CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_ 6 #define CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 10 matching lines...) Expand all
21 class Extension; 21 class Extension;
22 } 22 }
23 23
24 namespace tts_engine_events { 24 namespace tts_engine_events {
25 extern const char kOnSpeak[]; 25 extern const char kOnSpeak[];
26 extern const char kOnStop[]; 26 extern const char kOnStop[];
27 extern const char kOnPause[]; 27 extern const char kOnPause[];
28 extern const char kOnResume[]; 28 extern const char kOnResume[];
29 } 29 }
30 30
31 // TtsEngineDelegate implementation used by TtsController. 31 // Return a list of all available voices registered by extensions.
32 class TtsExtensionEngine : public TtsEngineDelegate { 32 void GetExtensionVoices(Profile* profile, std::vector<VoiceData>* out_voices);
33 public:
34 static TtsExtensionEngine* GetInstance();
35 33
36 // Overridden from TtsEngineDelegate: 34 // Find the first extension with a tts_voices in its
37 virtual void GetVoices(Profile* profile, 35 // manifest that matches the speech parameters of this utterance.
38 std::vector<VoiceData>* out_voices) OVERRIDE; 36 // If found, store a pointer to the extension in |matching_extension| and
39 virtual void Speak(Utterance* utterance, const VoiceData& voice) OVERRIDE; 37 // the index of the voice within the extension in |voice_index| and
40 virtual void Stop(Utterance* utterance) OVERRIDE; 38 // return true.
41 virtual void Pause(Utterance* utterance) OVERRIDE; 39 bool GetMatchingExtensionVoice(Utterance* utterance,
42 virtual void Resume(Utterance* utterance) OVERRIDE; 40 const extensions::Extension** matching_extension,
43 }; 41 size_t* voice_index);
42
43 // Speak the given utterance by sending an event to the given TTS engine
44 // extension voice.
45 void ExtensionTtsEngineSpeak(Utterance* utterance,
46 const VoiceData& voice);
47
48 // Stop speaking the given utterance by sending an event to the extension
49 // associated with this utterance.
50 void ExtensionTtsEngineStop(Utterance* utterance);
51
52 // Pause in the middle of speaking this utterance.
53 void ExtensionTtsEnginePause(Utterance* utterance);
54
55 // Resume speaking this utterance.
56 void ExtensionTtsEngineResume(Utterance* utterance);
44 57
45 // Hidden/internal extension function used to allow TTS engine extensions 58 // Hidden/internal extension function used to allow TTS engine extensions
46 // to send events back to the client that's calling tts.speak(). 59 // to send events back to the client that's calling tts.speak().
47 class ExtensionTtsEngineSendTtsEventFunction : public SyncExtensionFunction { 60 class ExtensionTtsEngineSendTtsEventFunction : public SyncExtensionFunction {
48 private: 61 private:
49 virtual ~ExtensionTtsEngineSendTtsEventFunction() {} 62 virtual ~ExtensionTtsEngineSendTtsEventFunction() {}
50 virtual bool RunImpl() OVERRIDE; 63 virtual bool RunImpl() OVERRIDE;
51 DECLARE_EXTENSION_FUNCTION("ttsEngine.sendTtsEvent", TTSENGINE_SENDTTSEVENT) 64 DECLARE_EXTENSION_FUNCTION("ttsEngine.sendTtsEvent", TTSENGINE_SENDTTSEVENT)
52 }; 65 };
53 66
54 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_ 67 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_
OLDNEW
« no previous file with comments | « AUTHORS ('k') | chrome/browser/speech/extension_api/tts_engine_extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698