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_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ |
6 #define CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ | 6 #define CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include "chrome/browser/speech/tts_controller.h" | 8 #include "chrome/browser/speech/tts_controller.h" |
9 #include "chrome/common/tts_messages.h" | 9 #include "chrome/common/tts_messages.h" |
10 #include "content/public/browser/browser_message_filter.h" | 10 #include "content/public/browser/browser_message_filter.h" |
11 | 11 |
12 class Profile; | 12 class Profile; |
13 | 13 |
14 class TtsMessageFilter | 14 class TtsMessageFilter |
15 : public content::BrowserMessageFilter, | 15 : public content::BrowserMessageFilter, |
16 public UtteranceEventDelegate { | 16 public UtteranceEventDelegate, |
| 17 public VoicesChangedDelegate { |
17 public: | 18 public: |
18 TtsMessageFilter(int render_process_id, Profile* profile); | 19 TtsMessageFilter(int render_process_id, Profile* profile); |
19 | 20 |
20 // content::BrowserMessageFilter implementation. | 21 // content::BrowserMessageFilter implementation. |
21 virtual void OverrideThreadForMessage( | 22 virtual void OverrideThreadForMessage( |
22 const IPC::Message& message, | 23 const IPC::Message& message, |
23 content::BrowserThread::ID* thread) OVERRIDE; | 24 content::BrowserThread::ID* thread) OVERRIDE; |
24 virtual bool OnMessageReceived(const IPC::Message& message, | 25 virtual bool OnMessageReceived(const IPC::Message& message, |
25 bool* message_was_ok) OVERRIDE; | 26 bool* message_was_ok) OVERRIDE; |
| 27 virtual void OnChannelClosing() OVERRIDE; |
26 | 28 |
27 // UtteranceEventDelegate implementation. | 29 // UtteranceEventDelegate implementation. |
28 virtual void OnTtsEvent(Utterance* utterance, | 30 virtual void OnTtsEvent(Utterance* utterance, |
29 TtsEventType event_type, | 31 TtsEventType event_type, |
30 int char_index, | 32 int char_index, |
31 const std::string& error_message) OVERRIDE; | 33 const std::string& error_message) OVERRIDE; |
32 | 34 |
| 35 // VoicesChangedDelegate implementation. |
| 36 virtual void OnVoicesChanged() OVERRIDE; |
| 37 |
33 private: | 38 private: |
34 virtual ~TtsMessageFilter(); | 39 virtual ~TtsMessageFilter(); |
35 | 40 |
36 void OnInitializeVoiceList(); | 41 void OnInitializeVoiceList(); |
37 void OnSpeak(const TtsUtteranceRequest& utterance); | 42 void OnSpeak(const TtsUtteranceRequest& utterance); |
38 void OnPause(); | 43 void OnPause(); |
39 void OnResume(); | 44 void OnResume(); |
40 void OnCancel(); | 45 void OnCancel(); |
41 | 46 |
42 int render_process_id_; | 47 int render_process_id_; |
43 Profile* profile_; | 48 Profile* profile_; |
44 | 49 |
45 DISALLOW_COPY_AND_ASSIGN(TtsMessageFilter); | 50 DISALLOW_COPY_AND_ASSIGN(TtsMessageFilter); |
46 }; | 51 }; |
47 | 52 |
48 #endif // CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ | 53 #endif // CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ |
OLD | NEW |