// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ #include <memory> #include <optional> #include "base/containers/flat_map.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "content/common/content_export.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/speech_recognition_event_listener.h" #include "content/public/browser/speech_recognition_manager.h" #include "content/public/browser/speech_recognition_session_config.h" #include "content/public/browser/speech_recognition_session_context.h" #include "media/mojo/mojom/speech_recognition.mojom.h" #include "media/mojo/mojom/speech_recognition_error.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/remote.h" #include "third_party/blink/public/mojom/mediastream/media_stream.mojom-forward.h" namespace media { class AudioSystem; } namespace content { class BrowserMainLoop; class MediaStreamManager; class MediaStreamUIProxy; class SpeechRecognitionManagerDelegate; class SpeechRecognizer; // This is the manager for speech recognition. It is a single instance in // the browser process and can serve several requests. Each recognition request // corresponds to a session, initiated via |CreateSession|. // // In any moment, the manager has a single session known as the primary session, // |primary_session_id_|. // This is the session that is capturing audio, waiting for user permission, // etc. There may also be other, non-primary, sessions living in parallel that // are waiting for results but not recording audio. // // The SpeechRecognitionManager has the following responsibilities: // - Handles requests received from various render frames and makes sure only // one of them accesses the audio device at any given time. // - Handles the instantiation of NetworkSpeechRecognitionEngineImpl objects // when requested by SpeechRecognitionSessions. // - Relays recognition results/status/error events of each session to the // corresponding listener (demuxing on the base of their session_id). // - Relays also recognition results/status/error events of every session to // the catch-all snoop listener (optionally) provided by the delegate. class CONTENT_EXPORT SpeechRecognitionManagerImpl : public SpeechRecognitionManager, public SpeechRecognitionEventListener { … }; } // namespace content #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_