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 CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ |
6 #define CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ | 6 #define CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "content/common/speech_input_result.h" | 9 #include "content/common/speech_input_result.h" |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 virtual void SetRecognitionResult( | 24 virtual void SetRecognitionResult( |
25 int caller_id, | 25 int caller_id, |
26 const SpeechInputResultArray& result) = 0; | 26 const SpeechInputResultArray& result) = 0; |
27 virtual void DidCompleteRecording(int caller_id) = 0; | 27 virtual void DidCompleteRecording(int caller_id) = 0; |
28 virtual void DidCompleteRecognition(int caller_id) = 0; | 28 virtual void DidCompleteRecognition(int caller_id) = 0; |
29 | 29 |
30 protected: | 30 protected: |
31 virtual ~Delegate() {} | 31 virtual ~Delegate() {} |
32 }; | 32 }; |
33 | 33 |
| 34 SpeechInputManager() : censor_results_(true) {} |
| 35 |
34 // Invokes the platform provided microphone settings UI in a non-blocking way, | 36 // Invokes the platform provided microphone settings UI in a non-blocking way, |
35 // via the BrowserThread::FILE thread. | 37 // via the BrowserThread::FILE thread. |
36 static void ShowAudioInputSettings(); | 38 static void ShowAudioInputSettings(); |
37 | 39 |
38 // Factory method to access the singleton. We have this method here instead of | 40 // Factory method to access the singleton. We have this method here instead of |
39 // using Singleton directly in the calling code to aid tests in injection | 41 // using Singleton directly in the calling code to aid tests in injection |
40 // mocks. | 42 // mocks. |
41 static SpeechInputManager* Get(); | 43 static SpeechInputManager* Get(); |
42 // Factory method definition useful for tests. | 44 // Factory method definition useful for tests. |
43 typedef SpeechInputManager* (AccessorMethod)(); | 45 typedef SpeechInputManager* (AccessorMethod)(); |
(...skipping 13 matching lines...) Expand all Loading... |
57 int render_process_id, | 59 int render_process_id, |
58 int render_view_id, | 60 int render_view_id, |
59 const gfx::Rect& element_rect, | 61 const gfx::Rect& element_rect, |
60 const std::string& language, | 62 const std::string& language, |
61 const std::string& grammar, | 63 const std::string& grammar, |
62 const std::string& origin_url) = 0; | 64 const std::string& origin_url) = 0; |
63 virtual void CancelRecognition(int caller_id) = 0; | 65 virtual void CancelRecognition(int caller_id) = 0; |
64 virtual void StopRecording(int caller_id) = 0; | 66 virtual void StopRecording(int caller_id) = 0; |
65 | 67 |
66 virtual void CancelAllRequestsWithDelegate(Delegate* delegate) = 0; | 68 virtual void CancelAllRequestsWithDelegate(Delegate* delegate) = 0; |
| 69 |
| 70 void set_censor_results(bool censor) { censor_results_ = censor; } |
| 71 |
| 72 bool censor_results() { return censor_results_; } |
| 73 private: |
| 74 bool censor_results_; |
67 }; | 75 }; |
68 | 76 |
69 // This typedef is to workaround the issue with certain versions of | 77 // This typedef is to workaround the issue with certain versions of |
70 // Visual Studio where it gets confused between multiple Delegate | 78 // Visual Studio where it gets confused between multiple Delegate |
71 // classes and gives a C2500 error. (I saw this error on the try bots - | 79 // classes and gives a C2500 error. (I saw this error on the try bots - |
72 // the workaround was not needed for my machine). | 80 // the workaround was not needed for my machine). |
73 typedef SpeechInputManager::Delegate SpeechInputManagerDelegate; | 81 typedef SpeechInputManager::Delegate SpeechInputManagerDelegate; |
74 | 82 |
75 } // namespace speech_input | 83 } // namespace speech_input |
76 | 84 |
77 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ | 85 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ |
OLD | NEW |