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

Side by Side Diff: content/renderer/tts_dispatcher.h

Issue 12589005: Implement web speech synthesis. (Closed) Base URL: http://git.chromium.org/chromium/src.git@webtts
Patch Set: Created 7 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_TTS_DISPATCHER_H_
6 #define CONTENT_RENDERER_TTS_DISPATCHER_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "content/public/renderer/render_view_observer.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechSynthesis.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechSynthesisCli ent.h"
14
15 namespace content {
16 class RenderViewImpl;
17 struct TtsVoice;
18
19 // TtsDispatcher is a delegate for methods used by WebKit for
20 // speech synthesis APIs. It's the complement of
21 // TtsDispatcherHost (owned by RenderViewHost).
22 class TtsDispatcher : public RenderViewObserver,
23 public WebKit::WebSpeechSynthesis {
24 public:
25 explicit TtsDispatcher(RenderViewImpl* render_view);
26 virtual ~TtsDispatcher();
27
28 private:
29 // RenderViewObserver implementation.
30 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
31
32 // WebKit::WebSpeechSynthesis implementation.
33 virtual void setClient(WebKit::WebSpeechSynthesisClient* client) OVERRIDE;
34 virtual void initializeVoiceList() OVERRIDE;
35 virtual void speak(const WebKit::WebSpeechSynthesisUtterance& utterance)
36 OVERRIDE;
37 virtual void pause() OVERRIDE;
38 virtual void resume() OVERRIDE;
39 virtual void cancel() OVERRIDE;
40
41 void OnSetVoiceList(const std::vector<content::TtsVoice>& voices);
42 void OnDidStartSpeaking(int utterance_id);
43 void OnDidFinishSpeaking(int utterance_id);
44 void OnDidPauseSpeaking(int utterance_id);
45 void OnDidResumeSpeaking(int utterance_id);
46 void OnWordBoundary(int utterance_id, int char_index);
47 void OnSentenceBoundary(int utterance_id, int char_index);
48 void OnMarkerEvent(int utterance_id, int char_index);
49 void OnWasInterrupted(int utterance_id);
50 void OnWasCancelled(int utterance_id);
51 void OnSpeakingErrorOccurred(int utterance_id,
52 const std::string& error_message);
53
54 // The WebKit client class that we use to send events back to the JS world.
55 WebKit::WebSpeechSynthesisClient* synthesis_client_;
tommi (sloooow) - chröme 2013/03/07 13:04:46 document ownership/scope?
dmazzoni 2013/03/19 17:30:22 Done.
56
57 DISALLOW_COPY_AND_ASSIGN(TtsDispatcher);
58 };
59
60 } // namespace content
61
62 #endif // CONTENT_RENDERER_TTS_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698