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 namespace content { | 13 namespace content { |
14 class BrowserContext; | 14 class BrowserContext; |
15 } | 15 } |
16 | 16 |
17 class TtsMessageFilter | 17 class TtsMessageFilter |
18 : public content::BrowserMessageFilter, | 18 : public content::BrowserMessageFilter, |
19 public UtteranceEventDelegate, | 19 public UtteranceEventDelegate, |
20 public VoicesChangedDelegate { | 20 public VoicesChangedDelegate { |
21 public: | 21 public: |
22 explicit TtsMessageFilter(int render_process_id, | 22 explicit TtsMessageFilter(int render_process_id, |
23 content::BrowserContext* browser_context); | 23 content::BrowserContext* browser_context); |
24 | 24 |
25 // content::BrowserMessageFilter implementation. | 25 // content::BrowserMessageFilter implementation. |
26 virtual void OverrideThreadForMessage( | 26 virtual void OverrideThreadForMessage( |
27 const IPC::Message& message, | 27 const IPC::Message& message, |
28 content::BrowserThread::ID* thread) OVERRIDE; | 28 content::BrowserThread::ID* thread) override; |
29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 29 virtual bool OnMessageReceived(const IPC::Message& message) override; |
30 virtual void OnChannelClosing() OVERRIDE; | 30 virtual void OnChannelClosing() override; |
31 virtual void OnDestruct() const OVERRIDE; | 31 virtual void OnDestruct() const override; |
32 | 32 |
33 // UtteranceEventDelegate implementation. | 33 // UtteranceEventDelegate implementation. |
34 virtual void OnTtsEvent(Utterance* utterance, | 34 virtual void OnTtsEvent(Utterance* utterance, |
35 TtsEventType event_type, | 35 TtsEventType event_type, |
36 int char_index, | 36 int char_index, |
37 const std::string& error_message) OVERRIDE; | 37 const std::string& error_message) override; |
38 | 38 |
39 // VoicesChangedDelegate implementation. | 39 // VoicesChangedDelegate implementation. |
40 virtual void OnVoicesChanged() OVERRIDE; | 40 virtual void OnVoicesChanged() override; |
41 | 41 |
42 private: | 42 private: |
43 friend class content::BrowserThread; | 43 friend class content::BrowserThread; |
44 friend class base::DeleteHelper<TtsMessageFilter>; | 44 friend class base::DeleteHelper<TtsMessageFilter>; |
45 | 45 |
46 virtual ~TtsMessageFilter(); | 46 virtual ~TtsMessageFilter(); |
47 | 47 |
48 void OnInitializeVoiceList(); | 48 void OnInitializeVoiceList(); |
49 void OnSpeak(const TtsUtteranceRequest& utterance); | 49 void OnSpeak(const TtsUtteranceRequest& utterance); |
50 void OnPause(); | 50 void OnPause(); |
51 void OnResume(); | 51 void OnResume(); |
52 void OnCancel(); | 52 void OnCancel(); |
53 | 53 |
54 void OnChannelClosingInUIThread(); | 54 void OnChannelClosingInUIThread(); |
55 | 55 |
56 int render_process_id_; | 56 int render_process_id_; |
57 content::BrowserContext* browser_context_; | 57 content::BrowserContext* browser_context_; |
58 | 58 |
59 base::WeakPtrFactory<TtsMessageFilter> weak_ptr_factory_; | 59 base::WeakPtrFactory<TtsMessageFilter> weak_ptr_factory_; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(TtsMessageFilter); | 61 DISALLOW_COPY_AND_ASSIGN(TtsMessageFilter); |
62 }; | 62 }; |
63 | 63 |
64 #endif // CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ | 64 #endif // CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_ |
OLD | NEW |