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 "chrome/common/speech_input_result.h" |
10 #include "gfx/rect.h" | 10 #include "gfx/rect.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 protected: | 31 protected: |
32 virtual ~Delegate() {} | 32 virtual ~Delegate() {} |
33 }; | 33 }; |
34 | 34 |
35 // Whether the speech input feature is enabled, based on the browser channel | 35 // Whether the speech input feature is enabled, based on the browser channel |
36 // information and command line flags. | 36 // information and command line flags. |
37 static bool IsFeatureEnabled(); | 37 static bool IsFeatureEnabled(); |
38 | 38 |
39 // Factory method to access the singleton. We have this method here instead of | 39 // Factory method to access the singleton. We have this method here instead of |
40 // using Singleton<> directly in the calling code to aid tests in injection | 40 // using Singleton directly in the calling code to aid tests in injection |
41 // mocks. | 41 // mocks. |
42 static SpeechInputManager* Get(); | 42 static SpeechInputManager* Get(); |
43 // Factory method definition useful for tests. | 43 // Factory method definition useful for tests. |
44 typedef SpeechInputManager* (AccessorMethod)(); | 44 typedef SpeechInputManager* (AccessorMethod)(); |
45 | 45 |
46 virtual ~SpeechInputManager() {} | 46 virtual ~SpeechInputManager() {} |
47 | 47 |
48 // Handlers for requests from render views. | 48 // Handlers for requests from render views. |
49 | 49 |
50 // |delegate| is a weak pointer and should remain valid until | 50 // |delegate| is a weak pointer and should remain valid until |
51 // its |DidCompleteRecognition| method is called or recognition is cancelled. | 51 // its |DidCompleteRecognition| method is called or recognition is cancelled. |
52 // |render_process_id| is the ID of the renderer process initiating the | 52 // |render_process_id| is the ID of the renderer process initiating the |
53 // request. | 53 // request. |
54 // |element_rect| is the display bounds of the html element requesting speech | 54 // |element_rect| is the display bounds of the html element requesting speech |
55 // input (in page coordinates). | 55 // input (in page coordinates). |
56 virtual void StartRecognition(Delegate* delegate, | 56 virtual void StartRecognition(Delegate* delegate, |
57 int caller_id, | 57 int caller_id, |
58 int render_process_id, | 58 int render_process_id, |
59 int render_view_id, | 59 int render_view_id, |
60 const gfx::Rect& element_rect, | 60 const gfx::Rect& element_rect, |
61 const std::string& language, | 61 const std::string& language, |
62 const std::string& grammar) = 0; | 62 const std::string& grammar, |
| 63 const std::string& origin_url) = 0; |
63 virtual void CancelRecognition(int caller_id) = 0; | 64 virtual void CancelRecognition(int caller_id) = 0; |
64 virtual void StopRecording(int caller_id) = 0; | 65 virtual void StopRecording(int caller_id) = 0; |
65 }; | 66 }; |
66 | 67 |
67 // This typedef is to workaround the issue with certain versions of | 68 // This typedef is to workaround the issue with certain versions of |
68 // Visual Studio where it gets confused between multiple Delegate | 69 // Visual Studio where it gets confused between multiple Delegate |
69 // classes and gives a C2500 error. (I saw this error on the try bots - | 70 // classes and gives a C2500 error. (I saw this error on the try bots - |
70 // the workaround was not needed for my machine). | 71 // the workaround was not needed for my machine). |
71 typedef SpeechInputManager::Delegate SpeechInputManagerDelegate; | 72 typedef SpeechInputManager::Delegate SpeechInputManagerDelegate; |
72 | 73 |
73 } // namespace speech_input | 74 } // namespace speech_input |
74 | 75 |
75 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ | 76 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ |
OLD | NEW |