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

Side by Side Diff: chrome/browser/speech/chrome_speech_input_manager.h

Issue 7729001: Get rid of link dependency from content to chrome. Make it get the SpeechInputManager through the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_H_
6 #define CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_H_
7
8 #include <map>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/singleton.h"
12 #include "chrome/browser/speech/speech_input_bubble_controller.h"
13 #include "content/browser/speech/speech_input_manager.h"
14 #include "content/browser/speech/speech_recognizer.h"
15
16 namespace speech_input {
17
18 class ChromeSpeechInputManager : public SpeechInputManager,
19 public SpeechInputBubbleControllerDelegate,
20 public SpeechRecognizerDelegate {
21 public:
22 static ChromeSpeechInputManager* GetInstance();
23
24 // SpeechInputManager methods.
25 virtual void StartRecognition(SpeechInputManagerDelegate* delegate,
26 int caller_id,
27 int render_process_id,
28 int render_view_id,
29 const gfx::Rect& element_rect,
30 const std::string& language,
31 const std::string& grammar,
32 const std::string& origin_url);
33 virtual void CancelRecognition(int caller_id);
34 virtual void StopRecording(int caller_id);
35 virtual void CancelAllRequestsWithDelegate(
36 SpeechInputManagerDelegate* delegate);
37
38 // SpeechRecognizer::Delegate methods.
39 virtual void DidStartReceivingAudio(int caller_id);
40 virtual void SetRecognitionResult(int caller_id,
41 bool error,
42 const SpeechInputResultArray& result);
43 virtual void DidCompleteRecording(int caller_id);
44 virtual void DidCompleteRecognition(int caller_id);
45 virtual void OnRecognizerError(int caller_id,
46 SpeechRecognizer::ErrorCode error);
47 virtual void DidCompleteEnvironmentEstimation(int caller_id);
48 virtual void SetInputVolume(int caller_id, float volume, float noise_volume);
49
50 // SpeechInputBubbleController::Delegate methods.
51 virtual void InfoBubbleButtonClicked(int caller_id,
52 SpeechInputBubble::Button button);
53 virtual void InfoBubbleFocusChanged(int caller_id);
54
55 private:
56 class OptionalRequestInfo;
57
58 struct SpeechInputRequest {
59 SpeechInputManagerDelegate* delegate;
60 scoped_refptr<SpeechRecognizer> recognizer;
61 bool is_active; // Set to true when recording or recognition is going on.
62 };
63
64 // Private constructor to enforce singleton.
65 friend struct DefaultSingletonTraits<ChromeSpeechInputManager>;
66 ChromeSpeechInputManager();
67 virtual ~ChromeSpeechInputManager();
68
69 bool HasPendingRequest(int caller_id) const;
70 SpeechInputManagerDelegate* GetDelegate(int caller_id) const;
71
72 void CancelRecognitionAndInformDelegate(int caller_id);
73
74 // Starts/restarts recognition for an existing request.
75 void StartRecognitionForRequest(int caller_id);
76
77 typedef std::map<int, SpeechInputRequest> SpeechRecognizerMap;
78 SpeechRecognizerMap requests_;
79 int recording_caller_id_;
80 scoped_refptr<SpeechInputBubbleController> bubble_controller_;
81 scoped_refptr<OptionalRequestInfo> optional_request_info_;
82
83 DISALLOW_COPY_AND_ASSIGN(ChromeSpeechInputManager);
84 };
85
86 } // namespace speech_input
87
88 #endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698