OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_RENDERER_SPEECH_INPUT_DISPATCHER_H_ | 5 #ifndef CHROME_RENDERER_SPEECH_INPUT_DISPATCHER_H_ |
6 #define CHROME_RENDERER_SPEECH_INPUT_DISPATCHER_H_ | 6 #define CHROME_RENDERER_SPEECH_INPUT_DISPATCHER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "chrome/common/speech_input_result.h" | 9 #include "chrome/common/speech_input_result.h" |
10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
11 #include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputController.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputController.h" |
12 | 12 |
13 class GURL; | 13 class GURL; |
14 class RenderView; | 14 class RenderView; |
15 | 15 |
16 namespace WebKit { | 16 namespace WebKit { |
| 17 class WebSpeechInputListener; |
17 class WebString; | 18 class WebString; |
18 struct WebRect; | 19 struct WebRect; |
19 class WebSpeechInputListener; | |
20 } | 20 } |
21 | 21 |
22 // SpeechInputDispatcher is a delegate for speech input messages used by WebKit. | 22 // SpeechInputDispatcher is a delegate for speech input messages used by WebKit. |
23 // It's the complement of SpeechInputDispatcherHost (owned by RenderViewHost). | 23 // It's the complement of SpeechInputDispatcherHost (owned by RenderViewHost). |
24 class SpeechInputDispatcher : public WebKit::WebSpeechInputController { | 24 class SpeechInputDispatcher : public WebKit::WebSpeechInputController { |
25 public: | 25 public: |
26 SpeechInputDispatcher(RenderView* render_view, | 26 SpeechInputDispatcher(RenderView* render_view, |
27 WebKit::WebSpeechInputListener* listener); | 27 WebKit::WebSpeechInputListener* listener); |
28 | 28 |
29 // Called to possibly handle the incoming IPC message. Returns true if | 29 // Called to possibly handle the incoming IPC message. Returns true if |
30 // handled. Called in render thread. | 30 // handled. Called in render thread. |
31 bool OnMessageReceived(const IPC::Message& msg); | 31 bool OnMessageReceived(const IPC::Message& msg); |
32 | 32 |
33 // WebKit::WebSpeechInputController. | 33 // WebKit::WebSpeechInputController. |
34 // TODO(leandro): this is a temporary fix for a two-sided patch. | |
35 // https://bugs.webkit.org/show_bug.cgi?id=47089 | |
36 bool startRecognition(int request_id, | 34 bool startRecognition(int request_id, |
37 const WebKit::WebRect& element_rect, | 35 const WebKit::WebRect& element_rect, |
38 const WebKit::WebString& language, | 36 const WebKit::WebString& language, |
39 const WebKit::WebString& grammar); | 37 const WebKit::WebString& grammar); |
40 | 38 |
41 bool startRecognition(int request_id, const WebKit::WebRect& element_rect, | |
42 const WebKit::WebString& grammar); | |
43 | |
44 void cancelRecognition(int request_id); | 39 void cancelRecognition(int request_id); |
45 void stopRecording(int request_id); | 40 void stopRecording(int request_id); |
46 | 41 |
47 private: | 42 private: |
48 void OnSpeechRecognitionResult( | 43 void OnSpeechRecognitionResult( |
49 int request_id, const speech_input::SpeechInputResultArray& result); | 44 int request_id, const speech_input::SpeechInputResultArray& result); |
50 void OnSpeechRecordingComplete(int request_id); | 45 void OnSpeechRecordingComplete(int request_id); |
51 void OnSpeechRecognitionComplete(int request_id); | 46 void OnSpeechRecognitionComplete(int request_id); |
52 | 47 |
53 RenderView* render_view_; | 48 RenderView* render_view_; |
54 WebKit::WebSpeechInputListener* listener_; | 49 WebKit::WebSpeechInputListener* listener_; |
55 | 50 |
56 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcher); | 51 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcher); |
57 }; | 52 }; |
58 | 53 |
59 #endif // CHROME_RENDERER_SPEECH_INPUT_DISPATCHER_H_ | 54 #endif // CHROME_RENDERER_SPEECH_INPUT_DISPATCHER_H_ |
OLD | NEW |