| 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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // Each TtsDispatcher is owned by the WebSpeechSynthesizerClient in Blink; | 25 // Each TtsDispatcher is owned by the WebSpeechSynthesizerClient in Blink; |
| 26 // it registers itself to listen to IPC upon construction and unregisters | 26 // it registers itself to listen to IPC upon construction and unregisters |
| 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::RenderThreadObserver { | 32 public content::RenderThreadObserver { |
| 33 public: | 33 public: |
| 34 explicit TtsDispatcher(blink::WebSpeechSynthesizerClient* client); | 34 explicit TtsDispatcher(blink::WebSpeechSynthesizerClient* client); |
| 35 ~TtsDispatcher() override; |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 ~TtsDispatcher() override; | |
| 38 | |
| 39 // RenderThreadObserver override. | 38 // RenderThreadObserver override. |
| 40 bool OnControlMessageReceived(const IPC::Message& message) override; | 39 bool OnControlMessageReceived(const IPC::Message& message) override; |
| 41 | 40 |
| 42 // blink::WebSpeechSynthesizer implementation. | 41 // blink::WebSpeechSynthesizer implementation. |
| 43 void UpdateVoiceList() override; | 42 void UpdateVoiceList() override; |
| 44 void Speak(const blink::WebSpeechSynthesisUtterance& utterance) override; | 43 void Speak(const blink::WebSpeechSynthesisUtterance& utterance) override; |
| 45 void Pause() override; | 44 void Pause() override; |
| 46 void Resume() override; | 45 void Resume() override; |
| 47 void Cancel() override; | 46 void Cancel() override; |
| 48 | 47 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 68 // Next utterance id, used to map response IPCs to utterance objects. | 67 // Next utterance id, used to map response IPCs to utterance objects. |
| 69 static int next_utterance_id_; | 68 static int next_utterance_id_; |
| 70 | 69 |
| 71 // Map from id to utterance objects. | 70 // Map from id to utterance objects. |
| 72 base::hash_map<int, blink::WebSpeechSynthesisUtterance> utterance_id_map_; | 71 base::hash_map<int, blink::WebSpeechSynthesisUtterance> utterance_id_map_; |
| 73 | 72 |
| 74 DISALLOW_COPY_AND_ASSIGN(TtsDispatcher); | 73 DISALLOW_COPY_AND_ASSIGN(TtsDispatcher); |
| 75 }; | 74 }; |
| 76 | 75 |
| 77 #endif // CHROME_RENDERER_TTS_DISPATCHER_H_ | 76 #endif // CHROME_RENDERER_TTS_DISPATCHER_H_ |
| OLD | NEW |