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_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
6 #define CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 6 #define CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "chrome/browser/browser_message_filter.h" | 9 #include "chrome/browser/browser_message_filter.h" |
10 #include "chrome/browser/speech/speech_input_manager.h" | 10 #include "chrome/browser/speech/speech_input_manager.h" |
11 | 11 |
| 12 struct SpeechInputHostMsg_StartRecognition_Params; |
| 13 |
12 namespace speech_input { | 14 namespace speech_input { |
13 | 15 |
14 // SpeechInputDispatcherHost is a delegate for Speech API messages used by | 16 // SpeechInputDispatcherHost is a delegate for Speech API messages used by |
15 // RenderMessageFilter. | 17 // RenderMessageFilter. |
16 // It's the complement of SpeechInputDispatcher (owned by RenderView). | 18 // It's the complement of SpeechInputDispatcher (owned by RenderView). |
17 class SpeechInputDispatcherHost : public BrowserMessageFilter, | 19 class SpeechInputDispatcherHost : public BrowserMessageFilter, |
18 public SpeechInputManager::Delegate { | 20 public SpeechInputManager::Delegate { |
19 public: | 21 public: |
20 class SpeechInputCallers; | 22 class SpeechInputCallers; |
21 | 23 |
(...skipping 10 matching lines...) Expand all Loading... |
32 bool* message_was_ok); | 34 bool* message_was_ok); |
33 | 35 |
34 // Singleton accessor setter useful for tests. | 36 // Singleton accessor setter useful for tests. |
35 static void set_manager_accessor(SpeechInputManager::AccessorMethod* method) { | 37 static void set_manager_accessor(SpeechInputManager::AccessorMethod* method) { |
36 manager_accessor_ = method; | 38 manager_accessor_ = method; |
37 } | 39 } |
38 | 40 |
39 private: | 41 private: |
40 virtual ~SpeechInputDispatcherHost(); | 42 virtual ~SpeechInputDispatcherHost(); |
41 | 43 |
42 void OnStartRecognition(int render_view_id, int request_id, | 44 void OnStartRecognition( |
43 const gfx::Rect& element_rect, | 45 const SpeechInputHostMsg_StartRecognition_Params ¶ms); |
44 const std::string& language, | |
45 const std::string& grammar); | |
46 void OnCancelRecognition(int render_view_id, int request_id); | 46 void OnCancelRecognition(int render_view_id, int request_id); |
47 void OnStopRecording(int render_view_id, int request_id); | 47 void OnStopRecording(int render_view_id, int request_id); |
48 | 48 |
49 // Returns the speech input manager to forward events to, creating one if | 49 // Returns the speech input manager to forward events to, creating one if |
50 // needed. | 50 // needed. |
51 SpeechInputManager* manager(); | 51 SpeechInputManager* manager(); |
52 | 52 |
53 int render_process_id_; | 53 int render_process_id_; |
54 | 54 |
55 static SpeechInputManager::AccessorMethod* manager_accessor_; | 55 static SpeechInputManager::AccessorMethod* manager_accessor_; |
56 | 56 |
57 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); | 57 DISALLOW_COPY_AND_ASSIGN(SpeechInputDispatcherHost); |
58 }; | 58 }; |
59 | 59 |
60 } // namespace speech_input | 60 } // namespace speech_input |
61 | 61 |
62 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ | 62 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_DISPATCHER_HOST_H_ |
OLD | NEW |