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

Side by Side Diff: content/browser/speech/speech_recognition_manager_impl.cc

Issue 10233010: Introducing new data types and IPC messages for scripted JS speech recognition APIs (Speech CL2.0) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added CONTENT_EXPORT to SpeechRecognitionEngine::Config 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 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 #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 "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "content/browser/browser_main_loop.h" 9 #include "content/browser/browser_main_loop.h"
10 #include "content/browser/speech/google_one_shot_remote_engine.h" 10 #include "content/browser/speech/google_one_shot_remote_engine.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 Session& session = sessions_[session_id]; 70 Session& session = sessions_[session_id];
71 session.id = session_id; 71 session.id = session_id;
72 session.event_listener = event_listener; 72 session.event_listener = event_listener;
73 session.context = config.initial_context; 73 session.context = config.initial_context;
74 74
75 std::string hardware_info; 75 std::string hardware_info;
76 bool can_report_metrics = false; 76 bool can_report_metrics = false;
77 if (delegate_) 77 if (delegate_)
78 delegate_->GetDiagnosticInformation(&can_report_metrics, &hardware_info); 78 delegate_->GetDiagnosticInformation(&can_report_metrics, &hardware_info);
79 79
80 GoogleOneShotRemoteEngineConfig remote_engine_config; 80 SpeechRecognitionEngineConfig remote_engine_config;
81 remote_engine_config.language = config.language; 81 remote_engine_config.language = config.language;
82 remote_engine_config.grammar = config.grammar; 82 remote_engine_config.grammars = config.grammars;
83 remote_engine_config.audio_sample_rate = 83 remote_engine_config.audio_sample_rate =
84 SpeechRecognizerImpl::kAudioSampleRate; 84 SpeechRecognizerImpl::kAudioSampleRate;
85 remote_engine_config.audio_num_bits_per_sample = 85 remote_engine_config.audio_num_bits_per_sample =
86 SpeechRecognizerImpl::kNumBitsPerAudioSample; 86 SpeechRecognizerImpl::kNumBitsPerAudioSample;
87 remote_engine_config.filter_profanities = config.filter_profanities; 87 remote_engine_config.filter_profanities = config.filter_profanities;
88 remote_engine_config.hardware_info = hardware_info; 88 remote_engine_config.hardware_info = hardware_info;
89 remote_engine_config.origin_url = can_report_metrics ? config.origin_url : ""; 89 remote_engine_config.origin_url = can_report_metrics ? config.origin_url : "";
90 90
91 GoogleOneShotRemoteEngine* google_remote_engine = 91 SpeechRecognitionEngine* google_remote_engine =
92 new GoogleOneShotRemoteEngine(config.url_request_context_getter); 92 new GoogleOneShotRemoteEngine(config.url_request_context_getter);
93 google_remote_engine->SetConfig(remote_engine_config); 93 google_remote_engine->SetConfig(remote_engine_config);
94 94
95 session.recognizer = new SpeechRecognizerImpl(this, 95 session.recognizer = new SpeechRecognizerImpl(this,
96 session_id, 96 session_id,
97 google_remote_engine); 97 google_remote_engine);
98 return session_id; 98 return session_id;
99 } 99 }
100 100
101 void SpeechRecognitionManagerImpl::StartSession(int session_id) { 101 void SpeechRecognitionManagerImpl::StartSession(int session_id) {
102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 SpeechRecognitionManagerImpl::Session::Session() 634 SpeechRecognitionManagerImpl::Session::Session()
635 : id(kSessionIDInvalid), 635 : id(kSessionIDInvalid),
636 event_listener(NULL), 636 event_listener(NULL),
637 state(STATE_IDLE) { 637 state(STATE_IDLE) {
638 } 638 }
639 639
640 SpeechRecognitionManagerImpl::Session::~Session() { 640 SpeechRecognitionManagerImpl::Session::~Session() {
641 } 641 }
642 642
643 } // namespace speech 643 } // namespace speech
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognition_engine.cc ('k') | content/browser/speech/speech_recognizer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698