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

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

Issue 9387023: Revert 121810 - Move SpeechRecognizer delegate into its own header file and put it in the content... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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) 2011 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_recognizer.h" 5 #include "content/browser/speech/speech_recognizer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/speech_recognizer_delegate.h"
11 #include "content/public/common/speech_input_result.h" 10 #include "content/public/common/speech_input_result.h"
12 #include "net/url_request/url_request_context_getter.h" 11 #include "net/url_request/url_request_context_getter.h"
13 12
14 using content::BrowserThread; 13 using content::BrowserThread;
15 using media::AudioInputController; 14 using media::AudioInputController;
16 using std::string; 15 using std::string;
17 16
18 namespace { 17 namespace {
19 18
20 // The following constants are related to the volume level indicator shown in 19 // The following constants are related to the volume level indicator shown in
(...skipping 29 matching lines...) Expand all
50 49
51 namespace speech_input { 50 namespace speech_input {
52 51
53 const int SpeechRecognizer::kAudioSampleRate = 16000; 52 const int SpeechRecognizer::kAudioSampleRate = 16000;
54 const int SpeechRecognizer::kAudioPacketIntervalMs = 100; 53 const int SpeechRecognizer::kAudioPacketIntervalMs = 100;
55 const ChannelLayout SpeechRecognizer::kChannelLayout = CHANNEL_LAYOUT_MONO; 54 const ChannelLayout SpeechRecognizer::kChannelLayout = CHANNEL_LAYOUT_MONO;
56 const int SpeechRecognizer::kNumBitsPerAudioSample = 16; 55 const int SpeechRecognizer::kNumBitsPerAudioSample = 16;
57 const int SpeechRecognizer::kNoSpeechTimeoutSec = 8; 56 const int SpeechRecognizer::kNoSpeechTimeoutSec = 8;
58 const int SpeechRecognizer::kEndpointerEstimationTimeMs = 300; 57 const int SpeechRecognizer::kEndpointerEstimationTimeMs = 300;
59 58
60 SpeechRecognizer::SpeechRecognizer(content::SpeechRecognizerDelegate* delegate, 59 SpeechRecognizer::SpeechRecognizer(Delegate* delegate,
61 int caller_id, 60 int caller_id,
62 const std::string& language, 61 const std::string& language,
63 const std::string& grammar, 62 const std::string& grammar,
64 net::URLRequestContextGetter* context_getter, 63 net::URLRequestContextGetter* context_getter,
65 AudioManager* audio_manager, 64 AudioManager* audio_manager,
66 bool filter_profanities, 65 bool filter_profanities,
67 const std::string& hardware_info, 66 const std::string& hardware_info,
68 const std::string& origin_url) 67 const std::string& origin_url)
69 : delegate_(delegate), 68 : delegate_(delegate),
70 caller_id_(caller_id), 69 caller_id_(caller_id),
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // and switch to async. version of this method. Compare with how 312 // and switch to async. version of this method. Compare with how
314 // it's done in e.g. the AudioRendererHost. 313 // it's done in e.g. the AudioRendererHost.
315 base::WaitableEvent closed_event(true, false); 314 base::WaitableEvent closed_event(true, false);
316 audio_controller_->Close(base::Bind(&base::WaitableEvent::Signal, 315 audio_controller_->Close(base::Bind(&base::WaitableEvent::Signal,
317 base::Unretained(&closed_event))); 316 base::Unretained(&closed_event)));
318 closed_event.Wait(); 317 closed_event.Wait();
319 audio_controller_ = NULL; // Releases the ref ptr. 318 audio_controller_ = NULL; // Releases the ref ptr.
320 } 319 }
321 320
322 } // namespace speech_input 321 } // namespace speech_input
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognizer.h ('k') | content/browser/speech/speech_recognizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698