| OLD | NEW |
| 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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" |
| 9 | 11 |
| 10 namespace content { | 12 namespace content { |
| 11 | 13 |
| 12 class SpeechRecognitionEventListener; | 14 class SpeechRecognitionEventListener; |
| 13 | 15 |
| 14 // Handles speech recognition for a session (identified by |session_id|). | 16 // Handles speech recognition for a session (identified by |session_id|). |
| 15 class CONTENT_EXPORT SpeechRecognizer | 17 class CONTENT_EXPORT SpeechRecognizer |
| 16 : public base::RefCountedThreadSafe<SpeechRecognizer> { | 18 : public base::RefCountedThreadSafe<SpeechRecognizer> { |
| 17 public: | 19 public: |
| 18 | 20 |
| 19 SpeechRecognizer(SpeechRecognitionEventListener* listener, int session_id) | 21 SpeechRecognizer(SpeechRecognitionEventListener* listener, int session_id) |
| 20 : listener_(listener), session_id_(session_id) {} | 22 : listener_(listener), session_id_(session_id) { |
| 23 DCHECK(listener_); |
| 24 } |
| 21 | 25 |
| 22 virtual void StartRecognition() = 0; | 26 virtual void StartRecognition() = 0; |
| 23 virtual void AbortRecognition() = 0; | 27 virtual void AbortRecognition() = 0; |
| 24 virtual void StopAudioCapture() = 0; | 28 virtual void StopAudioCapture() = 0; |
| 25 virtual bool IsActive() const = 0; | 29 virtual bool IsActive() const = 0; |
| 26 virtual bool IsCapturingAudio() const = 0; | 30 virtual bool IsCapturingAudio() const = 0; |
| 27 | 31 |
| 28 protected: | 32 protected: |
| 33 friend class base::RefCountedThreadSafe<SpeechRecognizer>; |
| 34 |
| 29 virtual ~SpeechRecognizer() {} | 35 virtual ~SpeechRecognizer() {} |
| 30 SpeechRecognitionEventListener* listener() const { return listener_; } | 36 SpeechRecognitionEventListener* listener() const { return listener_; } |
| 31 int session_id() const { return session_id_; } | 37 int session_id() const { return session_id_; } |
| 32 | 38 |
| 33 private: | 39 private: |
| 34 friend class base::RefCountedThreadSafe<SpeechRecognizer>; | |
| 35 | |
| 36 SpeechRecognitionEventListener* listener_; | 40 SpeechRecognitionEventListener* listener_; |
| 37 int session_id_; | 41 int session_id_; |
| 38 | 42 |
| 39 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer); | 43 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer); |
| 40 }; | 44 }; |
| 41 | 45 |
| 42 } // namespace content | 46 } // namespace content |
| 43 | 47 |
| 44 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 48 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
| OLD | NEW |