#ifndef CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_
#define CHROME_BROWSER_SPEECH_TTS_MESSAGE_FILTER_H_
#include "base/memory/weak_ptr.h"
#include "chrome/browser/speech/tts_controller.h"
#include "chrome/common/tts_messages.h"
#include "content/public/browser/browser_message_filter.h"
class Profile;
class TtsMessageFilter
: public content::BrowserMessageFilter,
public UtteranceEventDelegate,
public VoicesChangedDelegate,
public base::SupportsWeakPtr<TtsMessageFilter> {
public:
TtsMessageFilter(int render_process_id, Profile* profile);
virtual void OverrideThreadForMessage(
const IPC::Message& message,
content::BrowserThread::ID* thread) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message,
bool* message_was_ok) OVERRIDE;
virtual void OnChannelClosing() OVERRIDE;
virtual void OnTtsEvent(Utterance* utterance,
TtsEventType event_type,
int char_index,
const std::string& error_message) OVERRIDE;
virtual void OnVoicesChanged() OVERRIDE;
private:
virtual ~TtsMessageFilter();
void OnInitializeVoiceList();
void OnSpeak(const TtsUtteranceRequest& utterance);
void OnPause();
void OnResume();
void OnCancel();
void OnChannelClosingInUIThread();
int render_process_id_;
Profile* profile_;
DISALLOW_COPY_AND_ASSIGN(TtsMessageFilter);
};
#endif