Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: content/browser/speech/tts_dispatcher_host_impl.h

Issue 12589005: Implement web speech synthesis. (Closed) Base URL: http://git.chromium.org/chromium/src.git@webtts
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/speech/tts_dispatcher_host_impl.h
diff --git a/content/browser/speech/tts_dispatcher_host_impl.h b/content/browser/speech/tts_dispatcher_host_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..432ca35d1ab4fe52dd0cae93b54cde86408f6565
--- /dev/null
+++ b/content/browser/speech/tts_dispatcher_host_impl.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
hans 2013/03/09 14:19:52 2013 since it's a new file?
dmazzoni 2013/03/19 17:30:22 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_SPEECH_TTS_DISPATCHER_HOST_IMPL_H_
+#define CONTENT_BROWSER_SPEECH_TTS_DISPATCHER_HOST_IMPL_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "content/common/content_export.h"
+#include "content/common/tts_messages.h"
+#include "content/public/browser/browser_message_filter.h"
+#include "content/public/browser/tts_dispatcher_host.h"
+
+namespace content {
+
+// TtsDispatcherHost is a delegate for Speech API messages used by
+// RenderMessageFilter.
+class CONTENT_EXPORT TtsDispatcherHostImpl
+ : public BrowserMessageFilter,
+ public TtsDispatcherHost {
+ public:
+ TtsDispatcherHostImpl(int render_process_id,
+ BrowserContext* browser_context);
+
+ virtual BrowserContext* GetBrowserContext() OVERRIDE;
+
+ // TtsDispatcherHost methods.
+ virtual void DidStartSpeaking(int routing_id, int utterance_id) OVERRIDE;
+ virtual void DidFinishSpeaking(int routing_id, int utterance_id) OVERRIDE;
+ virtual void DidPauseSpeaking(int routing_id, int utterance_id) OVERRIDE;
+ virtual void DidResumeSpeaking(int routing_id, int utterance_id) OVERRIDE;
+ virtual void WordBoundary(
+ int routing_id, int utterance_id, int char_index) OVERRIDE;
+ virtual void SentenceBoundary(
+ int routing_id, int utterance_id, int char_index) OVERRIDE;
+ virtual void MarkerEvent(int routing_id, int utterance_id, int char_index)
+ OVERRIDE;
+ virtual void WasInterrupted(int routing_id, int utterance_id) OVERRIDE;
+ virtual void WasCancelled(int routing_id, int utterance_id) OVERRIDE;
+ virtual void SpeakingErrorOccurred(
+ int routing_id, int utterance_id, const std::string& error_message)
+ OVERRIDE;
+ virtual void SendVoiceList(int routing_id,
+ const std::vector<content::TtsVoice>&) OVERRIDE;
+
+ // BrowserMessageFilter implementation.
+ virtual bool OnMessageReceived(const IPC::Message& message,
+ bool* message_was_ok) OVERRIDE;
+
+ private:
+ virtual ~TtsDispatcherHostImpl();
+
+ void OnInitializeVoiceList(int routing_id);
+ void OnSpeak(int routing_id, const TtsUtteranceRequest& utterance);
+ void OnPause();
+ void OnResume();
+ void OnCancel();
+
+ int render_process_id_;
+ BrowserContext* browser_context_;
+ TtsDispatcherHostDelegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(TtsDispatcherHostImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_SPEECH_TTS_DISPATCHER_HOST_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698