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

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

Issue 549373003: Binding media stream audio track to speech recognition [browser] Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Audio Receiver unit test Created 6 years, 2 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
OLDNEW
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 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_
6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 class SpeechRecognitionEventListener; 14 class SpeechRecognitionEventListener;
15 15
16 // Handles speech recognition for a session (identified by |session_id|). 16 // Handles speech recognition for a session (identified by |session_id|).
17 class CONTENT_EXPORT SpeechRecognizer 17 class CONTENT_EXPORT SpeechRecognizer
18 : public base::RefCountedThreadSafe<SpeechRecognizer> { 18 : public base::RefCountedThreadSafe<SpeechRecognizer> {
19 public: 19 public:
20
21 SpeechRecognizer(SpeechRecognitionEventListener* listener, int session_id) 20 SpeechRecognizer(SpeechRecognitionEventListener* listener, int session_id)
22 : listener_(listener), session_id_(session_id) { 21 : listener_(listener), session_id_(session_id) {
23 DCHECK(listener_); 22 DCHECK(listener_);
24 } 23 }
25 24
26 virtual void StartRecognition(const std::string& device_id) = 0; 25 virtual void StartRecognition(const std::string& device_id) = 0;
27 virtual void AbortRecognition() = 0; 26 virtual void AbortRecognition() = 0;
28 virtual void StopAudioCapture() = 0; 27 virtual void StopAudioCapture() = 0;
29 virtual bool IsActive() const = 0; 28 virtual bool IsActive() const = 0;
30 virtual bool IsCapturingAudio() const = 0; 29 virtual bool IsCapturingAudio() const = 0;
31 30
32 protected: 31 protected:
33 friend class base::RefCountedThreadSafe<SpeechRecognizer>; 32 friend class base::RefCountedThreadSafe<SpeechRecognizer>;
34 33
35 virtual ~SpeechRecognizer() {} 34 virtual ~SpeechRecognizer() {}
36 SpeechRecognitionEventListener* listener() const { return listener_; } 35 SpeechRecognitionEventListener* listener() const { return listener_; }
37 int session_id() const { return session_id_; } 36 int session_id() const { return session_id_; }
38 37
39 private: 38 private:
40 SpeechRecognitionEventListener* listener_; 39 SpeechRecognitionEventListener* listener_;
41 int session_id_; 40 int session_id_;
42 41
43 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer); 42 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer);
44 }; 43 };
45 44
46 } // namespace content 45 } // namespace content
47 46
48 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ 47 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698