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

Unified Diff: content/browser/speech/input_tag_speech_dispatcher_host.cc

Issue 10399025: Moved instantiation of SpeechRecognitionManager inside browser_main_loop, instead of Singleton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed build issues. Created 8 years, 7 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
Index: content/browser/speech/input_tag_speech_dispatcher_host.cc
diff --git a/content/browser/speech/input_tag_speech_dispatcher_host.cc b/content/browser/speech/input_tag_speech_dispatcher_host.cc
index cf604829ec7477410c38c03faa2982475eded4d8..0fa54be0a6b808ac8e01fdf41bddc3263fcc9633 100644
--- a/content/browser/speech/input_tag_speech_dispatcher_host.cc
+++ b/content/browser/speech/input_tag_speech_dispatcher_host.cc
@@ -14,6 +14,7 @@
#include "content/public/browser/speech_recognition_session_context.h"
using content::BrowserThread;
+using content::SpeechRecognitionManager;
using content::SpeechRecognitionSessionConfig;
using content::SpeechRecognitionSessionContext;
@@ -29,11 +30,11 @@ bool IsSameContext(int render_process_id,
} // namespace
namespace speech {
-SpeechRecognitionManagerImpl* InputTagSpeechDispatcherHost::manager_;
+SpeechRecognitionManager* InputTagSpeechDispatcherHost::manager_for_tests_;
-void InputTagSpeechDispatcherHost::set_manager(
- SpeechRecognitionManagerImpl* manager) {
- manager_ = manager;
+void InputTagSpeechDispatcherHost::SetManagerForTests(
+ SpeechRecognitionManager* manager) {
+ manager_for_tests_ = manager;
}
InputTagSpeechDispatcherHost::InputTagSpeechDispatcherHost(
@@ -59,11 +60,11 @@ InputTagSpeechDispatcherHost::~InputTagSpeechDispatcherHost() {
manager()->AbortAllSessionsForListener(this);
}
-SpeechRecognitionManagerImpl* InputTagSpeechDispatcherHost::manager() {
- if (manager_)
- return manager_;
+SpeechRecognitionManager* InputTagSpeechDispatcherHost::manager() {
+ if (manager_for_tests_)
+ return manager_for_tests_;
#if defined(ENABLE_INPUT_SPEECH)
- return SpeechRecognitionManagerImpl::GetInstance();
+ return SpeechRecognitionManager::GetInstance();
#else
return NULL;
#endif
@@ -111,7 +112,7 @@ void InputTagSpeechDispatcherHost::OnStartRecognition(
config.event_listener = this;
int session_id = manager()->CreateSession(config);
- if (session_id == content::SpeechRecognitionManager::kSessionIDInvalid)
+ if (session_id == SpeechRecognitionManager::kSessionIDInvalid)
return;
manager()->StartSession(session_id);
@@ -125,7 +126,7 @@ void InputTagSpeechDispatcherHost::OnCancelRecognition(int render_view_id,
render_process_id_,
render_view_id,
request_id));
- if (session_id != content::SpeechRecognitionManager::kSessionIDInvalid)
+ if (session_id != SpeechRecognitionManager::kSessionIDInvalid)
manager()->AbortSession(session_id);
}
@@ -137,7 +138,7 @@ void InputTagSpeechDispatcherHost::OnStopRecording(int render_view_id,
render_process_id_,
render_view_id,
request_id));
- DCHECK_NE(session_id, content::SpeechRecognitionManager::kSessionIDInvalid);
+ DCHECK_NE(session_id, SpeechRecognitionManager::kSessionIDInvalid);
manager()->StopAudioCaptureForSession(session_id);
}
« no previous file with comments | « content/browser/speech/input_tag_speech_dispatcher_host.h ('k') | content/browser/speech/speech_recognition_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698