OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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 CONTENT_RENDERER_SPEECH_INPUT_DISPATCHER_H_ | |
6 #define CONTENT_RENDERER_SPEECH_INPUT_DISPATCHER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "content/public/renderer/render_view_observer.h" | |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSpeechInputControl
ler.h" | |
11 | |
12 class RenderViewImpl; | |
13 | |
14 namespace content { | |
15 struct SpeechInputResult; | |
16 } | |
17 | |
18 namespace WebKit { | |
19 class WebSpeechInputListener; | |
20 } | |
21 | |
22 // SpeechInputDispatcher is a delegate for speech input messages used by WebKit. | |
23 // It's the complement of SpeechInputDispatcherHost (owned by RenderViewHost). | |
24 class SpeechInputDispatcher : public content::RenderViewObserver, | |
25 public WebKit::WebSpeechInputController { | |
26 public: | |
27 SpeechInputDispatcher(RenderViewImpl* render_view, | |
28 WebKit::WebSpeechInputListener* listener); | |
29 | |
30 private: | |
31 // RenderView::Observer implementation. | |
32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
33 | |
34 // WebKit::WebSpeechInputController. | |
35 virtual bool startRecognition(int request_id, | |
36 const WebKit::WebRect& element_rect, | |
37 const WebKit::WebString& language, | |
38 const WebKit::WebString& grammar, | |
39 const WebKit::WebSecurityOrigin& origin); | |
40 | |
41 virtual void cancelRecognition(int request_id); | |
42 virtual void stopRecording(int request_id); | |
43 | |
44 void OnSpeechRecognitionResult(int request_id, | |
45 const content::SpeechInputResult& result); | |
46 void OnSpeechRecordingComplete(int request_id); | |
47 void OnSpeechRecognitionComplete(int request_id); | |
48 void OnSpeechRecognitionToggleSpeechInput(); | |
49 | |
50 WebKit::WebSpeechInputListener* listener_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcher); | |
53 }; | |
54 | |
55 #endif // CHROME_RENDERER_SPEECH_INPUT_DISPATCHER_H_ | |
OLD | NEW |