Chromium Code Reviews| Index: content/renderer/tts_dispatcher.h | 
| diff --git a/content/renderer/tts_dispatcher.h b/content/renderer/tts_dispatcher.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..3026dd8e6299e926137d3f1b602a8d0e7faacae5 | 
| --- /dev/null | 
| +++ b/content/renderer/tts_dispatcher.h | 
| @@ -0,0 +1,62 @@ | 
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#ifndef CONTENT_RENDERER_TTS_DISPATCHER_H_ | 
| +#define CONTENT_RENDERER_TTS_DISPATCHER_H_ | 
| + | 
| +#include <vector> | 
| + | 
| +#include "base/basictypes.h" | 
| +#include "content/public/renderer/render_view_observer.h" | 
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechSynthesis.h" | 
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechSynthesisClient.h" | 
| + | 
| +namespace content { | 
| +class RenderViewImpl; | 
| +struct TtsVoice; | 
| + | 
| +// TtsDispatcher is a delegate for methods used by WebKit for | 
| +// speech synthesis APIs. It's the complement of | 
| +// TtsDispatcherHost (owned by RenderViewHost). | 
| +class TtsDispatcher : public RenderViewObserver, | 
| + public WebKit::WebSpeechSynthesis { | 
| + public: | 
| + explicit TtsDispatcher(RenderViewImpl* render_view); | 
| + virtual ~TtsDispatcher(); | 
| + | 
| + private: | 
| + // RenderViewObserver implementation. | 
| + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 
| + | 
| + // WebKit::WebSpeechSynthesis implementation. | 
| + virtual void setClient(WebKit::WebSpeechSynthesisClient* client) OVERRIDE; | 
| + virtual void initializeVoiceList() OVERRIDE; | 
| + virtual void speak(const WebKit::WebSpeechSynthesisUtterance& utterance) | 
| + OVERRIDE; | 
| + virtual void pause() OVERRIDE; | 
| + virtual void resume() OVERRIDE; | 
| + virtual void cancel() OVERRIDE; | 
| + | 
| + void OnSetVoiceList(const std::vector<content::TtsVoice>& voices); | 
| + void OnDidStartSpeaking(int utterance_id); | 
| + void OnDidFinishSpeaking(int utterance_id); | 
| + void OnDidPauseSpeaking(int utterance_id); | 
| + void OnDidResumeSpeaking(int utterance_id); | 
| + void OnWordBoundary(int utterance_id, int char_index); | 
| + void OnSentenceBoundary(int utterance_id, int char_index); | 
| + void OnMarkerEvent(int utterance_id, int char_index); | 
| + void OnWasInterrupted(int utterance_id); | 
| + void OnWasCancelled(int utterance_id); | 
| + void OnSpeakingErrorOccurred(int utterance_id, | 
| + const std::string& error_message); | 
| + | 
| + // The WebKit client class that we use to send events back to the JS world. | 
| + WebKit::WebSpeechSynthesisClient* synthesis_client_; | 
| 
 
tommi (sloooow) - chröme
2013/03/07 13:04:46
document ownership/scope?
 
dmazzoni
2013/03/19 17:30:22
Done.
 
 | 
| + | 
| + DISALLOW_COPY_AND_ASSIGN(TtsDispatcher); | 
| +}; | 
| + | 
| +} // namespace content | 
| + | 
| +#endif // CONTENT_RENDERER_TTS_DISPATCHER_H_ |