Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / speech / speech_recognizer.h
blob92feebb375533c3a6c19ff3b8ad796994d218663
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_
6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_
8 #include "base/logging.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/common/content_export.h"
12 namespace content {
14 class SpeechRecognitionEventListener;
16 // Handles speech recognition for a session (identified by |session_id|).
17 class CONTENT_EXPORT SpeechRecognizer
18 : public base::RefCountedThreadSafe<SpeechRecognizer> {
19 public:
21 SpeechRecognizer(SpeechRecognitionEventListener* listener, int session_id)
22 : listener_(listener), session_id_(session_id) {
23 DCHECK(listener_);
26 virtual void StartRecognition(const std::string& device_id) = 0;
27 virtual void AbortRecognition() = 0;
28 virtual void StopAudioCapture() = 0;
29 virtual bool IsActive() const = 0;
30 virtual bool IsCapturingAudio() const = 0;
32 protected:
33 friend class base::RefCountedThreadSafe<SpeechRecognizer>;
35 virtual ~SpeechRecognizer() {}
36 SpeechRecognitionEventListener* listener() const { return listener_; }
37 int session_id() const { return session_id_; }
39 private:
40 SpeechRecognitionEventListener* listener_;
41 int session_id_;
43 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer);
46 } // namespace content
48 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_