| OLD | NEW |
| 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ | 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/memory/weak_ptr.h" |
| 15 #include "content/public/browser/speech_recognition_event_listener.h" | 16 #include "content/public/browser/speech_recognition_event_listener.h" |
| 16 #include "content/public/browser/speech_recognition_manager.h" | 17 #include "content/public/browser/speech_recognition_manager.h" |
| 17 #include "content/public/browser/speech_recognition_session_config.h" | 18 #include "content/public/browser/speech_recognition_session_config.h" |
| 18 #include "content/public/browser/speech_recognition_session_context.h" | 19 #include "content/public/browser/speech_recognition_session_context.h" |
| 19 #include "content/public/common/speech_recognition_error.h" | 20 #include "content/public/common/speech_recognition_error.h" |
| 20 | 21 |
| 21 namespace content { | 22 namespace content { |
| 22 class BrowserMainLoop; | 23 class BrowserMainLoop; |
| 23 class SpeechRecognitionManagerDelegate; | 24 class SpeechRecognitionManagerDelegate; |
| 24 } | 25 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 42 // - Handles requests received from various render views and makes sure only | 43 // - Handles requests received from various render views and makes sure only |
| 43 // one of them accesses the audio device at any given time. | 44 // one of them accesses the audio device at any given time. |
| 44 // - Handles the instantiation of SpeechRecognitionEngine objects when | 45 // - Handles the instantiation of SpeechRecognitionEngine objects when |
| 45 // requested by SpeechRecognitionSessions. | 46 // requested by SpeechRecognitionSessions. |
| 46 // - Relays recognition results/status/error events of each session to the | 47 // - Relays recognition results/status/error events of each session to the |
| 47 // corresponding listener (demuxing on the base of their session_id). | 48 // corresponding listener (demuxing on the base of their session_id). |
| 48 // - Relays also recognition results/status/error events of every session to | 49 // - Relays also recognition results/status/error events of every session to |
| 49 // the catch-all snoop listener (optionally) provided by the delegate. | 50 // the catch-all snoop listener (optionally) provided by the delegate. |
| 50 class CONTENT_EXPORT SpeechRecognitionManagerImpl : | 51 class CONTENT_EXPORT SpeechRecognitionManagerImpl : |
| 51 public NON_EXPORTED_BASE(content::SpeechRecognitionManager), | 52 public NON_EXPORTED_BASE(content::SpeechRecognitionManager), |
| 53 public base::SupportsWeakPtr<SpeechRecognitionManagerImpl>, |
| 52 public content::SpeechRecognitionEventListener { | 54 public content::SpeechRecognitionEventListener { |
| 53 public: | 55 public: |
| 54 // Returns the current SpeechRecognitionManagerImpl. Can be called only after | 56 // Returns the current SpeechRecognitionManagerImpl or NULL if the call is |
| 55 // the RecognitionMnager has been created (by BrowserMainLoop). | 57 // issued when it is not created yet or destroyed (by BrowserMainLoop). |
| 56 static SpeechRecognitionManagerImpl* GetInstance(); | 58 static SpeechRecognitionManagerImpl* GetInstance(); |
| 57 | 59 |
| 58 // SpeechRecognitionManager implementation. | 60 // SpeechRecognitionManager implementation. |
| 59 virtual int CreateSession( | 61 virtual int CreateSession( |
| 60 const content::SpeechRecognitionSessionConfig& config) OVERRIDE; | 62 const content::SpeechRecognitionSessionConfig& config) OVERRIDE; |
| 61 virtual void StartSession(int session_id) OVERRIDE; | 63 virtual void StartSession(int session_id) OVERRIDE; |
| 62 virtual void AbortSession(int session_id) OVERRIDE; | 64 virtual void AbortSession(int session_id) OVERRIDE; |
| 63 virtual void AbortAllSessionsForListener( | 65 virtual void AbortAllSessionsForListener( |
| 64 content::SpeechRecognitionEventListener* listener) OVERRIDE; | 66 content::SpeechRecognitionEventListener* listener) OVERRIDE; |
| 65 virtual void StopAudioCaptureForSession(int session_id) OVERRIDE; | 67 virtual void StopAudioCaptureForSession(int session_id) OVERRIDE; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 SessionsTable sessions_; | 162 SessionsTable sessions_; |
| 161 int session_id_capturing_audio_; | 163 int session_id_capturing_audio_; |
| 162 int last_session_id_; | 164 int last_session_id_; |
| 163 bool is_dispatching_event_; | 165 bool is_dispatching_event_; |
| 164 scoped_ptr<content::SpeechRecognitionManagerDelegate> delegate_; | 166 scoped_ptr<content::SpeechRecognitionManagerDelegate> delegate_; |
| 165 }; | 167 }; |
| 166 | 168 |
| 167 } // namespace speech | 169 } // namespace speech |
| 168 | 170 |
| 169 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ | 171 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ |
| OLD | NEW |