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