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

Unified Diff: chrome/browser/speech/chrome_speech_input_manager.h

Issue 7838028: Refactor SpeechInputManager between chrome/ and content/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/speech/chrome_speech_input_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/speech/chrome_speech_input_manager.h
diff --git a/chrome/browser/speech/chrome_speech_input_manager.h b/chrome/browser/speech/chrome_speech_input_manager.h
index f16bcb3a19800936164b53be8af66b1fc4f36433..09b28ed3f74f81240103ce58a584f2b90eb0d3cb 100644
--- a/chrome/browser/speech/chrome_speech_input_manager.h
+++ b/chrome/browser/speech/chrome_speech_input_manager.h
@@ -5,83 +5,52 @@
#ifndef CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_H_
#define CHROME_BROWSER_SPEECH_CHROME_SPEECH_INPUT_MANAGER_H_
-#include <map>
-
#include "base/memory/ref_counted.h"
#include "base/memory/singleton.h"
#include "chrome/browser/speech/speech_input_bubble_controller.h"
#include "content/browser/speech/speech_input_manager.h"
-#include "content/browser/speech/speech_recognizer.h"
namespace speech_input {
// This is Chrome's implementation of the SpeechInputManager interface. This
// class is a singleton and accessed via the Get method.
class ChromeSpeechInputManager : public SpeechInputManager,
- public SpeechInputBubbleControllerDelegate,
- public SpeechRecognizerDelegate {
+ public SpeechInputBubbleControllerDelegate {
public:
static ChromeSpeechInputManager* GetInstance();
- // SpeechInputManager methods.
- virtual void StartRecognition(SpeechInputManagerDelegate* delegate,
- int caller_id,
- int render_process_id,
- int render_view_id,
- const gfx::Rect& element_rect,
- const std::string& language,
- const std::string& grammar,
- const std::string& origin_url);
- virtual void CancelRecognition(int caller_id);
- virtual void StopRecording(int caller_id);
- virtual void CancelAllRequestsWithDelegate(
- SpeechInputManagerDelegate* delegate);
-
- // SpeechRecognizer::Delegate methods.
- virtual void DidStartReceivingAudio(int caller_id);
- virtual void SetRecognitionResult(int caller_id,
- bool error,
- const SpeechInputResultArray& result);
- virtual void DidCompleteRecording(int caller_id);
- virtual void DidCompleteRecognition(int caller_id);
- virtual void OnRecognizerError(int caller_id,
- SpeechRecognizer::ErrorCode error);
- virtual void DidCompleteEnvironmentEstimation(int caller_id);
- virtual void SetInputVolume(int caller_id, float volume, float noise_volume);
-
// SpeechInputBubbleController::Delegate methods.
virtual void InfoBubbleButtonClicked(int caller_id,
SpeechInputBubble::Button button);
virtual void InfoBubbleFocusChanged(int caller_id);
+ protected:
+ // SpeechInputManager methods.
+ virtual void GetRequestInfo(bool* can_report_metrics,
+ std::string* request_info);
+ virtual void ShowRecognitionRequested(int caller_id,
+ int render_process_id,
+ int render_view_id,
+ const gfx::Rect& element_rect);
+ virtual void ShowWarmUp(int caller_id);
+ virtual void ShowRecognizing(int caller_id);
+ virtual void ShowRecording(int caller_id);
+ virtual void ShowInputVolume(int caller_id,
+ float volume,
+ float noise_volume);
+ virtual void ShowNoMicError(int caller_id);
+ virtual void ShowRecognizerError(int caller_id,
+ SpeechRecognizer::ErrorCode error);
+ virtual void DoClose(int caller_id);
+
private:
class OptionalRequestInfo;
- struct SpeechInputRequest {
- SpeechInputRequest();
- ~SpeechInputRequest();
-
- SpeechInputManagerDelegate* delegate;
- scoped_refptr<SpeechRecognizer> recognizer;
- bool is_active; // Set to true when recording or recognition is going on.
- };
-
// Private constructor to enforce singleton.
friend struct DefaultSingletonTraits<ChromeSpeechInputManager>;
ChromeSpeechInputManager();
virtual ~ChromeSpeechInputManager();
- bool HasPendingRequest(int caller_id) const;
- SpeechInputManagerDelegate* GetDelegate(int caller_id) const;
-
- void CancelRecognitionAndInformDelegate(int caller_id);
-
- // Starts/restarts recognition for an existing request.
- void StartRecognitionForRequest(int caller_id);
-
- typedef std::map<int, SpeechInputRequest> SpeechRecognizerMap;
- SpeechRecognizerMap requests_;
- int recording_caller_id_;
scoped_refptr<SpeechInputBubbleController> bubble_controller_;
scoped_refptr<OptionalRequestInfo> optional_request_info_;
« no previous file with comments | « no previous file | chrome/browser/speech/chrome_speech_input_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698