#include "chrome/browser/speech/chrome_speech_recognition_service.h"
#include <string>
#include <unordered_set>
#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
#include "base/metrics/histogram_functions.h"
#include "base/scoped_observation.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/component_updater/soda_language_pack_component_installer.h"
#include "chrome/grit/generated_resources.h"
#include "components/live_caption/pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/soda/constants.h"
#include "components/soda/soda_installer.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/service_process_host.h"
#include "media/base/media_switches.h"
#include "media/mojo/mojom/speech_recognition_service.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_features.h"
#endif
namespace speech {
constexpr base::TimeDelta kIdleProcessTimeout = …;
ChromeSpeechRecognitionService::ChromeSpeechRecognitionService(
content::BrowserContext* context)
: … { … }
ChromeSpeechRecognitionService::~ChromeSpeechRecognitionService() = default;
void ChromeSpeechRecognitionService::BindSpeechRecognitionContext(
mojo::PendingReceiver<media::mojom::SpeechRecognitionContext> receiver) { … }
void ChromeSpeechRecognitionService::BindAudioSourceSpeechRecognitionContext(
mojo::PendingReceiver<media::mojom::AudioSourceSpeechRecognitionContext>
receiver) { … }
void ChromeSpeechRecognitionService::OnSodaInstalled(
speech::LanguageCode language_code) { … }
void ChromeSpeechRecognitionService::OnSodaInstallError(
speech::LanguageCode language_code,
speech::SodaInstaller::ErrorCode error_code) { … }
void ChromeSpeechRecognitionService::OnSodaProgress(
speech::LanguageCode language_code,
int progress) { … }
void ChromeSpeechRecognitionService::LaunchIfNotRunning() { … }
base::flat_map<std::string, base::FilePath>
ChromeSpeechRecognitionService::GetSodaConfigPaths() { … }
}