#include "chrome/browser/ui/views/global_media_controls/media_dialog_view.h"
#include <memory>
#include <string>
#include <utility>
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/observer_list.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/ui/global_media_controls/media_item_ui_metrics.h"
#include "chrome/browser/ui/global_media_controls/media_notification_service.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/controls/rich_hover_button.h"
#include "chrome/browser/ui/views/global_media_controls/media_dialog_view_observer.h"
#include "chrome/browser/ui/views/global_media_controls/media_item_ui_device_selector_view.h"
#include "chrome/browser/ui/views/global_media_controls/media_item_ui_footer_view.h"
#include "chrome/browser/ui/views/global_media_controls/media_item_ui_helper.h"
#include "chrome/browser/ui/views/global_media_controls/media_item_ui_legacy_cast_footer_view.h"
#include "chrome/grit/generated_resources.h"
#include "components/global_media_controls/public/constants.h"
#include "components/global_media_controls/public/media_item_manager.h"
#include "components/global_media_controls/public/views/media_item_ui_detailed_view.h"
#include "components/global_media_controls/public/views/media_item_ui_list_view.h"
#include "components/global_media_controls/public/views/media_item_ui_updated_view.h"
#include "components/global_media_controls/public/views/media_item_ui_view.h"
#include "components/live_caption/caption_util.h"
#include "components/live_caption/pref_names.h"
#include "components/media_router/browser/media_router.h"
#include "components/media_router/browser/media_router_factory.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/sessions/content/session_tab_helper.h"
#include "components/soda/constants.h"
#include "components/sync_preferences/pref_service_syncable.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/media_session.h"
#include "content/public/browser/web_contents.h"
#include "media/base/media_switches.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "net/base/url_util.h"
#include "services/media_session/public/mojom/media_session.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/background.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/toggle_button.h"
#include "ui/views/controls/combobox/combobox.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/separator.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/style/typography.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/views_features.h"
GlobalMediaControlsEntryPoint;
MediaSessionAction;
namespace {
static constexpr int kHorizontalMarginDip = …;
static constexpr int kImageWidthDip = …;
static constexpr int kVerticalMarginDip = …;
std::u16string GetLiveCaptionTitle(PrefService* profile_prefs) { … }
}
MediaDialogView* MediaDialogView::instance_ = …;
bool MediaDialogView::has_been_opened_ = …;
views::Widget* MediaDialogView::ShowDialogFromToolbar(
views::View* anchor_view,
MediaNotificationService* service,
Profile* profile) { … }
views::Widget* MediaDialogView::ShowDialogCentered(
const gfx::Rect& bounds,
MediaNotificationService* service,
Profile* profile,
content::WebContents* contents,
global_media_controls::GlobalMediaControlsEntryPoint entry_point) { … }
views::Widget* MediaDialogView::ShowDialog(
views::View* anchor_view,
views::BubbleBorder::Arrow anchor_position,
MediaNotificationService* service,
Profile* profile,
content::WebContents* contents,
global_media_controls::GlobalMediaControlsEntryPoint entry_point) { … }
void MediaDialogView::HideDialog() { … }
bool MediaDialogView::IsShowing() { … }
global_media_controls::MediaItemUI* MediaDialogView::ShowMediaItem(
const std::string& id,
base::WeakPtr<media_message_center::MediaNotificationItem> item) { … }
void MediaDialogView::HideMediaItem(const std::string& id) { … }
void MediaDialogView::RefreshMediaItem(
const std::string& id,
base::WeakPtr<media_message_center::MediaNotificationItem> item) { … }
void MediaDialogView::HideMediaDialog() { … }
void MediaDialogView::Focus() { … }
void MediaDialogView::AddedToWidget() { … }
gfx::Size MediaDialogView::CalculatePreferredSize(
const views::SizeBounds& available_size) const { … }
void MediaDialogView::UpdateBubbleSize() { … }
void MediaDialogView::OnLiveCaptionEnabledChanged() { … }
void MediaDialogView::OnLiveTranslateEnabledChanged() { … }
void MediaDialogView::OnMediaItemUISizeChanged() { … }
void MediaDialogView::OnMediaItemUIMetadataChanged() { … }
void MediaDialogView::OnMediaItemUIActionsChanged() { … }
void MediaDialogView::OnMediaItemUIDestroyed(const std::string& id) { … }
void MediaDialogView::AddObserver(MediaDialogViewObserver* observer) { … }
void MediaDialogView::RemoveObserver(MediaDialogViewObserver* observer) { … }
void MediaDialogView::TargetLanguageChanged() { … }
const std::map<const std::string, global_media_controls::MediaItemUIView*>&
MediaDialogView::GetItemsForTesting() const { … }
const std::map<const std::string,
global_media_controls::MediaItemUIUpdatedView*>&
MediaDialogView::GetUpdatedItemsForTesting() const { … }
const global_media_controls::MediaItemUIListView*
MediaDialogView::GetListViewForTesting() const { … }
MediaDialogView::MediaDialogView(
views::View* anchor_view,
views::BubbleBorder::Arrow anchor_position,
MediaNotificationService* service,
Profile* profile,
content::WebContents* contents,
global_media_controls::GlobalMediaControlsEntryPoint entry_point)
: … { … }
MediaDialogView::~MediaDialogView() { … }
void MediaDialogView::Init() { … }
void MediaDialogView::WindowClosing() { … }
void MediaDialogView::OnLiveCaptionButtonPressed() { … }
void MediaDialogView::OnLiveTranslateButtonPressed() { … }
void MediaDialogView::OnSettingsButtonPressed() { … }
void MediaDialogView::OnSodaInstalled(speech::LanguageCode language_code) { … }
void MediaDialogView::OnSodaInstallError(
speech::LanguageCode language_code,
speech::SodaInstaller::ErrorCode error_code) { … }
void MediaDialogView::OnSodaProgress(speech::LanguageCode language_code,
int progress) { … }
void MediaDialogView::InitializeLiveCaptionSection() { … }
void MediaDialogView::InitializeLiveTranslateSection() { … }
void MediaDialogView::InitializeCaptionSettingsSection() { … }
void MediaDialogView::SetLiveCaptionTitle(const std::u16string& new_text) { … }
std::unique_ptr<global_media_controls::MediaItemUIView>
MediaDialogView::BuildMediaItemUIView(
const std::string& id,
base::WeakPtr<media_message_center::MediaNotificationItem> item) { … }
std::unique_ptr<global_media_controls::MediaItemUIUpdatedView>
MediaDialogView::BuildMediaItemUIUpdatedView(
const std::string& id,
base::WeakPtr<media_message_center::MediaNotificationItem> item) { … }
BEGIN_METADATA(…)