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

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 also SpeechRecognitionSessionContext 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 Session& session = sessions_[session_id]; 69 Session& session = sessions_[session_id];
70 session.id = session_id; 70 session.id = session_id;
71 session.event_listener = event_listener; 71 session.event_listener = event_listener;
72 session.context = config.initial_context; 72 session.context = config.initial_context;
73 73
74 std::string hardware_info; 74 std::string hardware_info;
75 bool can_report_metrics = false; 75 bool can_report_metrics = false;
76 if (delegate_) 76 if (delegate_)
77 delegate_->GetDiagnosticInformation(&can_report_metrics, &hardware_info); 77 delegate_->GetDiagnosticInformation(&can_report_metrics, &hardware_info);
78 78
79 GoogleOneShotRemoteEngineConfig remote_engine_config; 79 SpeechRecognitionEngineConfig remote_engine_config;
80 remote_engine_config.language = config.language; 80 remote_engine_config.language = config.language;
81 remote_engine_config.grammar = config.grammar; 81 remote_engine_config.grammars = config.grammars;
82 remote_engine_config.audio_sample_rate = 82 remote_engine_config.audio_sample_rate =
83 SpeechRecognizerImpl::kAudioSampleRate; 83 SpeechRecognizerImpl::kAudioSampleRate;
84 remote_engine_config.audio_num_bits_per_sample = 84 remote_engine_config.audio_num_bits_per_sample =
85 SpeechRecognizerImpl::kNumBitsPerAudioSample; 85 SpeechRecognizerImpl::kNumBitsPerAudioSample;
86 remote_engine_config.filter_profanities = config.filter_profanities; 86 remote_engine_config.filter_profanities = config.filter_profanities;
87 remote_engine_config.hardware_info = hardware_info; 87 remote_engine_config.hardware_info = hardware_info;
88 remote_engine_config.origin_url = can_report_metrics ? config.origin_url : ""; 88 remote_engine_config.origin_url = can_report_metrics ? config.origin_url : "";
89 89
90 GoogleOneShotRemoteEngine* google_remote_engine = 90 SpeechRecognitionEngine* google_remote_engine =
91 new GoogleOneShotRemoteEngine(config.url_request_context_getter); 91 new GoogleOneShotRemoteEngine(config.url_request_context_getter);
92 google_remote_engine->SetConfig(remote_engine_config); 92 google_remote_engine->SetConfig(remote_engine_config);
93 93
94 session.recognizer = new SpeechRecognizerImpl(this, 94 session.recognizer = new SpeechRecognizerImpl(this,
95 session_id, 95 session_id,
96 google_remote_engine); 96 google_remote_engine);
97 return session_id; 97 return session_id;
98 } 98 }
99 99
100 void SpeechRecognitionManagerImpl::StartSession(int session_id) { 100 void SpeechRecognitionManagerImpl::StartSession(int session_id) {
101 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 101 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 SpeechRecognitionManagerImpl::Session::Session() 617 SpeechRecognitionManagerImpl::Session::Session()
618 : id(kSessionIDInvalid), 618 : id(kSessionIDInvalid),
619 event_listener(NULL), 619 event_listener(NULL),
620 state(STATE_IDLE) { 620 state(STATE_IDLE) {
621 } 621 }
622 622
623 SpeechRecognitionManagerImpl::Session::~Session() { 623 SpeechRecognitionManagerImpl::Session::~Session() {
624 } 624 }
625 625
626 } // namespace speech 626 } // namespace speech
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698