// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_LIVE_CAPTION_VIEWS_CAPTION_BUBBLE_MODEL_H_ #define COMPONENTS_LIVE_CAPTION_VIEWS_CAPTION_BUBBLE_MODEL_H_ #include <string> #include "base/functional/callback.h" #include "base/memory/raw_ptr.h" #include "base/types/id_type.h" namespace captions { class CaptionBubble; class CaptionBubbleContext; // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. // LINT.IfChange(CaptionBubbleErrorType) enum CaptionBubbleErrorType { … }; // LINT.ThenChange(/tools/metrics/histograms/metadata/accessibility/enums.xml:CaptionBubbleErrorType) OnErrorClickedCallback; OnDoNotShowAgainClickedCallback; OnCaptionBubbleClosedCallback; /////////////////////////////////////////////////////////////////////////////// // Caption Bubble Model // // A representation of the data a caption bubble needs for a particular media // stream. The caption bubble controller sets the value of the text. The // caption bubble observes the model, and when the values change, the observer // is alerted. // // There exists one CaptionBubble and one CaptionBubbleControllerViews per // profile, but one CaptionBubbleModel per media stream. The CaptionBubbleModel // is owned by the CaptionBubbleControllerViews. It is created when // transcriptions from a new media stream are received and exists until the // audio stream ends for that stream. // // Partial text is a speech result that is subject to change. Incoming partial // texts overlap with the previous partial text. // Final text is the final transcription from the speech service that no // longer changes. Incoming partial texts do not overlap with final text. // When a final result is received from the speech service, the partial text is // appended to the end of the final text. The caption bubble displays the full // final + partial text. // class CaptionBubbleModel { … }; } // namespace captions #endif // COMPONENTS_LIVE_CAPTION_VIEWS_CAPTION_BUBBLE_MODEL_H_