#include "components/live_caption/views/caption_bubble_controller_views.h"
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include "base/functional/bind.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "components/live_caption/caption_bubble_context.h"
#include "components/live_caption/live_caption_controller.h"
#include "components/live_caption/views/caption_bubble.h"
#include "components/live_caption/views/caption_bubble_model.h"
#include "components/prefs/pref_service.h"
#include "components/soda/soda_installer.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
namespace captions {
std::unique_ptr<CaptionBubbleController> CaptionBubbleController::Create(
PrefService* profile_prefs,
const std::string& application_locale) { … }
CaptionBubbleControllerViews::CaptionBubbleControllerViews(
PrefService* profile_prefs,
const std::string& application_locale)
: … { … }
CaptionBubbleControllerViews::~CaptionBubbleControllerViews() { … }
void CaptionBubbleControllerViews::OnCaptionBubbleDestroyed() { … }
bool CaptionBubbleControllerViews::OnTranscription(
CaptionBubbleContext* caption_bubble_context,
const media::SpeechRecognitionResult& result) { … }
void CaptionBubbleControllerViews::OnError(
CaptionBubbleContext* caption_bubble_context,
CaptionBubbleErrorType error_type,
OnErrorClickedCallback error_clicked_callback,
OnDoNotShowAgainClickedCallback error_silenced_callback) { … }
void CaptionBubbleControllerViews::OnAudioStreamEnd(
CaptionBubbleContext* caption_bubble_context) { … }
void CaptionBubbleControllerViews::UpdateCaptionStyle(
std::optional<ui::CaptionStyle> caption_style) { … }
void CaptionBubbleControllerViews::SetActiveModel(
CaptionBubbleContext* caption_bubble_context) { … }
void CaptionBubbleControllerViews::OnSessionEnded(
const std::string& session_id) { … }
void CaptionBubbleControllerViews::OnSessionReset(
const std::string& session_id) { … }
bool CaptionBubbleControllerViews::IsWidgetVisibleForTesting() { … }
bool CaptionBubbleControllerViews::IsGenericErrorMessageVisibleForTesting() { … }
std::string CaptionBubbleControllerViews::GetBubbleLabelTextForTesting() { … }
void CaptionBubbleControllerViews::CloseActiveModelForTesting() { … }
views::Widget* CaptionBubbleControllerViews::GetCaptionWidgetForTesting() { … }
CaptionBubble* CaptionBubbleControllerViews::GetCaptionBubbleForTesting() { … }
void CaptionBubbleControllerViews::OnLanguageIdentificationEvent(
CaptionBubbleContext* caption_bubble_context,
const media::mojom::LanguageIdentificationEventPtr& event) { … }
void CaptionBubbleControllerViews::OnSodaInstalled(
speech::LanguageCode language_code) { … }
void CaptionBubbleControllerViews::OnSodaInstallError(
speech::LanguageCode language_code,
speech::SodaInstaller::ErrorCode error_code) { … }
void CaptionBubbleControllerViews::OnSodaProgress(
speech::LanguageCode language_code,
int progress) { … }
}