OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/browser/speech/speech_recognition_manager_impl.h" | 5 #include "content/browser/speech/speech_recognition_manager_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/browser/browser_main_loop.h" | 8 #include "content/browser/browser_main_loop.h" |
9 #include "content/browser/renderer_host/media/media_stream_manager.h" | 9 #include "content/browser/renderer_host/media/media_stream_manager.h" |
10 #include "content/browser/speech/google_one_shot_remote_engine.h" | 10 #include "content/browser/speech/google_one_shot_remote_engine.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 remote_engine_config.continuous = config.continuous; | 111 remote_engine_config.continuous = config.continuous; |
112 remote_engine_config.interim_results = config.interim_results; | 112 remote_engine_config.interim_results = config.interim_results; |
113 remote_engine_config.max_hypotheses = config.max_hypotheses; | 113 remote_engine_config.max_hypotheses = config.max_hypotheses; |
114 remote_engine_config.hardware_info = hardware_info; | 114 remote_engine_config.hardware_info = hardware_info; |
115 remote_engine_config.origin_url = | 115 remote_engine_config.origin_url = |
116 can_report_metrics ? config.origin_url : std::string(); | 116 can_report_metrics ? config.origin_url : std::string(); |
117 | 117 |
118 SpeechRecognitionEngine* google_remote_engine; | 118 SpeechRecognitionEngine* google_remote_engine; |
119 if (config.is_legacy_api) { | 119 if (config.is_legacy_api) { |
120 google_remote_engine = | 120 google_remote_engine = |
121 new GoogleOneShotRemoteEngine(config.url_request_context_getter); | 121 new GoogleOneShotRemoteEngine(config.url_request_context_getter.get()); |
122 } else { | 122 } else { |
123 google_remote_engine = | 123 google_remote_engine = new GoogleStreamingRemoteEngine( |
124 new GoogleStreamingRemoteEngine(config.url_request_context_getter); | 124 config.url_request_context_getter.get()); |
125 } | 125 } |
126 | 126 |
127 google_remote_engine->SetConfig(remote_engine_config); | 127 google_remote_engine->SetConfig(remote_engine_config); |
128 | 128 |
129 session.recognizer = new SpeechRecognizerImpl( | 129 session.recognizer = new SpeechRecognizerImpl( |
130 this, | 130 this, |
131 session_id, | 131 session_id, |
132 !config.continuous, | 132 !config.continuous, |
133 google_remote_engine); | 133 google_remote_engine); |
134 #else | 134 #else |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 session.recognizer->StopAudioCapture(); | 595 session.recognizer->StopAudioCapture(); |
596 } | 596 } |
597 | 597 |
598 void SpeechRecognitionManagerImpl::ResetCapturingSessionId( | 598 void SpeechRecognitionManagerImpl::ResetCapturingSessionId( |
599 const Session& session) { | 599 const Session& session) { |
600 DCHECK_EQ(primary_session_id_, session.id); | 600 DCHECK_EQ(primary_session_id_, session.id); |
601 primary_session_id_ = kSessionIDInvalid; | 601 primary_session_id_ = kSessionIDInvalid; |
602 } | 602 } |
603 | 603 |
604 void SpeechRecognitionManagerImpl::SessionDelete(const Session& session) { | 604 void SpeechRecognitionManagerImpl::SessionDelete(const Session& session) { |
605 DCHECK(session.recognizer == NULL || !session.recognizer->IsActive()); | 605 DCHECK(session.recognizer.get() == NULL || !session.recognizer->IsActive()); |
606 if (primary_session_id_ == session.id) | 606 if (primary_session_id_ == session.id) |
607 primary_session_id_ = kSessionIDInvalid; | 607 primary_session_id_ = kSessionIDInvalid; |
608 sessions_.erase(session.id); | 608 sessions_.erase(session.id); |
609 } | 609 } |
610 | 610 |
611 void SpeechRecognitionManagerImpl::NotFeasible(const Session& session, | 611 void SpeechRecognitionManagerImpl::NotFeasible(const Session& session, |
612 FSMEvent event) { | 612 FSMEvent event) { |
613 NOTREACHED() << "Unfeasible event " << event | 613 NOTREACHED() << "Unfeasible event " << event |
614 << " in state " << GetSessionState(session.id) | 614 << " in state " << GetSessionState(session.id) |
615 << " for session " << session.id; | 615 << " for session " << session.id; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 | 672 |
673 SpeechRecognitionManagerImpl::Session::Session() | 673 SpeechRecognitionManagerImpl::Session::Session() |
674 : id(kSessionIDInvalid), | 674 : id(kSessionIDInvalid), |
675 listener_is_active(true) { | 675 listener_is_active(true) { |
676 } | 676 } |
677 | 677 |
678 SpeechRecognitionManagerImpl::Session::~Session() { | 678 SpeechRecognitionManagerImpl::Session::~Session() { |
679 } | 679 } |
680 | 680 |
681 } // namespace content | 681 } // namespace content |
OLD | NEW |