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