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_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ |
6 #define CHROME_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ | 6 #define CHROME_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "chrome/common/speech_input_result.h" |
9 #include "gfx/rect.h" | 10 #include "gfx/rect.h" |
10 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
11 | 12 |
12 namespace speech_input { | 13 namespace speech_input { |
13 | 14 |
14 // This is the gatekeeper for speech recognition in the browser process. It | 15 // This is the gatekeeper for speech recognition in the browser process. It |
15 // handles requests received from various render views and makes sure only one | 16 // handles requests received from various render views and makes sure only one |
16 // of them can use speech recognition at a time. It also sends recognition | 17 // of them can use speech recognition at a time. It also sends recognition |
17 // results and status events to the render views when required. | 18 // results and status events to the render views when required. |
18 // This class is a singleton and accessed via the Get method. | 19 // This class is a singleton and accessed via the Get method. |
19 class SpeechInputManager { | 20 class SpeechInputManager { |
20 public: | 21 public: |
21 // Implemented by the dispatcher host to relay events to the render views. | 22 // Implemented by the dispatcher host to relay events to the render views. |
22 class Delegate { | 23 class Delegate { |
23 public: | 24 public: |
24 virtual void SetRecognitionResult(int caller_id, const string16& value) = 0; | 25 virtual void SetRecognitionResult( |
| 26 int caller_id, |
| 27 const SpeechInputResultArray& result) = 0; |
25 virtual void DidCompleteRecording(int caller_id) = 0; | 28 virtual void DidCompleteRecording(int caller_id) = 0; |
26 virtual void DidCompleteRecognition(int caller_id) = 0; | 29 virtual void DidCompleteRecognition(int caller_id) = 0; |
27 | 30 |
28 protected: | 31 protected: |
29 virtual ~Delegate() {} | 32 virtual ~Delegate() {} |
30 }; | 33 }; |
31 | 34 |
32 // Factory method to access the singleton. We have this method here instead of | 35 // Factory method to access the singleton. We have this method here instead of |
33 // using Singleton<> directly in the calling code to aid tests in injection | 36 // using Singleton<> directly in the calling code to aid tests in injection |
34 // mocks. | 37 // mocks. |
(...skipping 22 matching lines...) Expand all Loading... |
57 | 60 |
58 // This typedef is to workaround the issue with certain versions of | 61 // This typedef is to workaround the issue with certain versions of |
59 // Visual Studio where it gets confused between multiple Delegate | 62 // Visual Studio where it gets confused between multiple Delegate |
60 // classes and gives a C2500 error. (I saw this error on the try bots - | 63 // classes and gives a C2500 error. (I saw this error on the try bots - |
61 // the workaround was not needed for my machine). | 64 // the workaround was not needed for my machine). |
62 typedef SpeechInputManager::Delegate SpeechInputManagerDelegate; | 65 typedef SpeechInputManager::Delegate SpeechInputManagerDelegate; |
63 | 66 |
64 } // namespace speech_input | 67 } // namespace speech_input |
65 | 68 |
66 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ | 69 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ |
OLD | NEW |