OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_RENDERER_TTS_DISPATCHER_H_ | 5 #ifndef CHROME_RENDERER_TTS_DISPATCHER_H_ |
6 #define CHROME_RENDERER_TTS_DISPATCHER_H_ | 6 #define CHROME_RENDERER_TTS_DISPATCHER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // itself when deleted. There can be multiple TtsDispatchers alive at once, | 27 // itself when deleted. There can be multiple TtsDispatchers alive at once, |
28 // so each one routes IPC messages to its WebSpeechSynthesizerClient only if | 28 // so each one routes IPC messages to its WebSpeechSynthesizerClient only if |
29 // the utterance id (which is globally unique) matches. | 29 // the utterance id (which is globally unique) matches. |
30 class TtsDispatcher | 30 class TtsDispatcher |
31 : public blink::WebSpeechSynthesizer, | 31 : public blink::WebSpeechSynthesizer, |
32 public content::RenderProcessObserver { | 32 public content::RenderProcessObserver { |
33 public: | 33 public: |
34 explicit TtsDispatcher(blink::WebSpeechSynthesizerClient* client); | 34 explicit TtsDispatcher(blink::WebSpeechSynthesizerClient* client); |
35 | 35 |
36 private: | 36 private: |
37 virtual ~TtsDispatcher(); | 37 ~TtsDispatcher() override; |
38 | 38 |
39 // RenderProcessObserver override. | 39 // RenderProcessObserver override. |
40 bool OnControlMessageReceived(const IPC::Message& message) override; | 40 bool OnControlMessageReceived(const IPC::Message& message) override; |
41 | 41 |
42 // blink::WebSpeechSynthesizer implementation. | 42 // blink::WebSpeechSynthesizer implementation. |
43 virtual void updateVoiceList() override; | 43 void updateVoiceList() override; |
44 virtual void speak(const blink::WebSpeechSynthesisUtterance& utterance) | 44 void speak(const blink::WebSpeechSynthesisUtterance& utterance) override; |
45 override; | 45 void pause() override; |
46 virtual void pause() override; | 46 void resume() override; |
47 virtual void resume() override; | 47 void cancel() override; |
48 virtual void cancel() override; | |
49 | 48 |
50 blink::WebSpeechSynthesisUtterance FindUtterance(int utterance_id); | 49 blink::WebSpeechSynthesisUtterance FindUtterance(int utterance_id); |
51 | 50 |
52 void OnSetVoiceList(const std::vector<TtsVoice>& voices); | 51 void OnSetVoiceList(const std::vector<TtsVoice>& voices); |
53 void OnDidStartSpeaking(int utterance_id); | 52 void OnDidStartSpeaking(int utterance_id); |
54 void OnDidFinishSpeaking(int utterance_id); | 53 void OnDidFinishSpeaking(int utterance_id); |
55 void OnDidPauseSpeaking(int utterance_id); | 54 void OnDidPauseSpeaking(int utterance_id); |
56 void OnDidResumeSpeaking(int utterance_id); | 55 void OnDidResumeSpeaking(int utterance_id); |
57 void OnWordBoundary(int utterance_id, int char_index); | 56 void OnWordBoundary(int utterance_id, int char_index); |
58 void OnSentenceBoundary(int utterance_id, int char_index); | 57 void OnSentenceBoundary(int utterance_id, int char_index); |
(...skipping 10 matching lines...) Expand all Loading... |
69 // Next utterance id, used to map response IPCs to utterance objects. | 68 // Next utterance id, used to map response IPCs to utterance objects. |
70 static int next_utterance_id_; | 69 static int next_utterance_id_; |
71 | 70 |
72 // Map from id to utterance objects. | 71 // Map from id to utterance objects. |
73 base::hash_map<int, blink::WebSpeechSynthesisUtterance> utterance_id_map_; | 72 base::hash_map<int, blink::WebSpeechSynthesisUtterance> utterance_id_map_; |
74 | 73 |
75 DISALLOW_COPY_AND_ASSIGN(TtsDispatcher); | 74 DISALLOW_COPY_AND_ASSIGN(TtsDispatcher); |
76 }; | 75 }; |
77 | 76 |
78 #endif // CHROME_RENDERER_TTS_DISPATCHER_H_ | 77 #endif // CHROME_RENDERER_TTS_DISPATCHER_H_ |
OLD | NEW |