Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(714)

Side by Side Diff: content/browser/speech/speech_input_manager.h

Issue 9390007: Move SpeechRecognizer delegate into its own header file and put it in the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jam review - update interface comment Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "content/browser/speech/speech_recognizer.h" 12 #include "base/memory/ref_counted.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/public/browser/speech_recognizer_delegate.h"
14 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
15 16
17 class AudioManager;
18
16 namespace content { 19 namespace content {
17 class ResourceContext; 20 class ResourceContext;
18 class SpeechInputPreferences; 21 class SpeechInputPreferences;
19 struct SpeechInputResult; 22 struct SpeechInputResult;
20 } 23 }
21 24
25 namespace net {
26 class URLRequestContextGetter;
27 }
28
22 namespace speech_input { 29 namespace speech_input {
30 class SpeechRecognizer;
23 31
24 // This is the gatekeeper for speech recognition in the browser process. It 32 // This is the gatekeeper for speech recognition in the browser process. It
25 // handles requests received from various render views and makes sure only one 33 // handles requests received from various render views and makes sure only one
26 // of them can use speech recognition at a time. It also sends recognition 34 // of them can use speech recognition at a time. It also sends recognition
27 // results and status events to the render views when required. 35 // results and status events to the render views when required.
28 class CONTENT_EXPORT SpeechInputManager : public SpeechRecognizerDelegate { 36 class CONTENT_EXPORT SpeechInputManager
37 : public content::SpeechRecognizerDelegate {
29 public: 38 public:
30 // Implemented by the dispatcher host to relay events to the render views. 39 // Implemented by the dispatcher host to relay events to the render views.
31 class Delegate { 40 class Delegate {
32 public: 41 public:
33 virtual void SetRecognitionResult( 42 virtual void SetRecognitionResult(
34 int caller_id, 43 int caller_id,
35 const content::SpeechInputResult& result) = 0; 44 const content::SpeechInputResult& result) = 0;
36 virtual void DidCompleteRecording(int caller_id) = 0; 45 virtual void DidCompleteRecording(int caller_id) = 0;
37 virtual void DidCompleteRecognition(int caller_id) = 0; 46 virtual void DidCompleteRecognition(int caller_id) = 0;
38 47
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 const std::string& language, 86 const std::string& language,
78 const std::string& grammar, 87 const std::string& grammar,
79 const std::string& origin_url, 88 const std::string& origin_url,
80 net::URLRequestContextGetter* context_getter, 89 net::URLRequestContextGetter* context_getter,
81 content::SpeechInputPreferences* speech_input_prefs, 90 content::SpeechInputPreferences* speech_input_prefs,
82 AudioManager* audio_manager); 91 AudioManager* audio_manager);
83 virtual void CancelRecognition(int caller_id); 92 virtual void CancelRecognition(int caller_id);
84 virtual void CancelAllRequestsWithDelegate(Delegate* delegate); 93 virtual void CancelAllRequestsWithDelegate(Delegate* delegate);
85 virtual void StopRecording(int caller_id); 94 virtual void StopRecording(int caller_id);
86 95
87 // SpeechRecognizerDelegate methods. 96 // Overridden from content::SpeechRecognizerDelegate:
88 virtual void DidStartReceivingAudio(int caller_id) OVERRIDE; 97 virtual void DidStartReceivingAudio(int caller_id) OVERRIDE;
89 virtual void SetRecognitionResult( 98 virtual void SetRecognitionResult(
90 int caller_id, 99 int caller_id,
91 const content::SpeechInputResult& result) OVERRIDE; 100 const content::SpeechInputResult& result) OVERRIDE;
92 virtual void DidCompleteRecording(int caller_id) OVERRIDE; 101 virtual void DidCompleteRecording(int caller_id) OVERRIDE;
93 virtual void DidCompleteRecognition(int caller_id) OVERRIDE; 102 virtual void DidCompleteRecognition(int caller_id) OVERRIDE;
94 virtual void DidStartReceivingSpeech(int caller_id) OVERRIDE; 103 virtual void DidStartReceivingSpeech(int caller_id) OVERRIDE;
95 virtual void DidStopReceivingSpeech(int caller_id) OVERRIDE; 104 virtual void DidStopReceivingSpeech(int caller_id) OVERRIDE;
96 105
97 virtual void OnRecognizerError(int caller_id, 106 virtual void OnRecognizerError(int caller_id,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 185
177 // This typedef is to workaround the issue with certain versions of 186 // This typedef is to workaround the issue with certain versions of
178 // Visual Studio where it gets confused between multiple Delegate 187 // Visual Studio where it gets confused between multiple Delegate
179 // classes and gives a C2500 error. (I saw this error on the try bots - 188 // classes and gives a C2500 error. (I saw this error on the try bots -
180 // the workaround was not needed for my machine). 189 // the workaround was not needed for my machine).
181 typedef SpeechInputManager::Delegate SpeechInputManagerDelegate; 190 typedef SpeechInputManager::Delegate SpeechInputManagerDelegate;
182 191
183 } // namespace speech_input 192 } // namespace speech_input
184 193
185 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ 194 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_
OLDNEW
« no previous file with comments | « content/browser/speech/speech_input_browsertest.cc ('k') | content/browser/speech/speech_input_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698