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

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

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