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