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