chromium/chrome/browser/ui/views/global_media_controls/media_item_ui_device_selector_view.cc

// 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.

#include "chrome/browser/ui/views/global_media_controls/media_item_ui_device_selector_view.h"

#include <utility>

#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/not_fatal_until.h"
#include "base/observer_list.h"
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/global_media_controls/media_item_ui_device_selector_delegate.h"
#include "chrome/browser/ui/global_media_controls/media_item_ui_metrics.h"
#include "chrome/browser/ui/views/global_media_controls/media_item_ui_device_selector_observer.h"
#include "chrome/grit/generated_resources.h"
#include "components/global_media_controls/public/views/media_item_ui_view.h"
#include "components/media_message_center/media_notification_item.h"
#include "components/media_router/browser/media_router_metrics.h"
#include "components/media_router/common/media_sink.h"
#include "components/media_router/common/mojom/media_route_provider_id.mojom.h"
#include "components/media_router/common/mojom/media_router.mojom.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "media/audio/audio_device_description.h"
#include "media/base/media_switches.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/models/image_model.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/border.h"
#include "ui/views/bubble/bubble_border.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/box_layout_view.h"

MediaRouterMetrics;
MediaRouteProviderId;

namespace {

// Constants for the MediaItemUIDeviceSelectorView
const int kExpandButtonStripWidth =;
const int kExpandButtonStripHeight =;
constexpr auto kExpandButtonStripInsets =;
constexpr auto kExpandButtonBorderInsets =;

// Constant for DropdownButton
const int kDropdownButtonIconSize =;
const int kDropdownButtonBackgroundRadius =;
constexpr gfx::Insets kDropdownButtonBorderInsets{};

// The maximum number of audio devices to count when recording the
// Media.GlobalMediaControls.NumberOfAvailableAudioDevices histogram. 30 was
// chosen because it would be very unlikely to see a user with 30+ audio
// devices.
const int kAudioDevicesCountHistogramMax =;

class ExpandDeviceSelectorLabel : public views::Label {};

BEGIN_METADATA()

class ExpandDeviceSelectorButton : public views::ToggleImageButton {};

BEGIN_METADATA()

}  // namespace

ExpandDeviceSelectorLabel::ExpandDeviceSelectorLabel(
    global_media_controls::GlobalMediaControlsEntryPoint entry_point) {}

void ExpandDeviceSelectorLabel::OnColorsChanged(SkColor foreground_color,
                                                SkColor background_color) {}

ExpandDeviceSelectorButton::ExpandDeviceSelectorButton(PressedCallback callback,
                                                       SkColor foreground_color)
    :{}

void ExpandDeviceSelectorButton::OnColorsChanged(SkColor foreground_color) {}

MediaItemUIDeviceSelectorView::MediaItemUIDeviceSelectorView(
    const std::string& item_id,
    MediaItemUIDeviceSelectorDelegate* delegate,
    mojo::PendingRemote<global_media_controls::mojom::DeviceListHost>
        device_list_host,
    mojo::PendingReceiver<global_media_controls::mojom::DeviceListClient>
        receiver,
    bool has_audio_output,
    global_media_controls::GlobalMediaControlsEntryPoint entry_point,
    bool show_devices,
    std::optional<media_message_center::MediaColorTheme> media_color_theme)
    :{}

void MediaItemUIDeviceSelectorView::UpdateCurrentAudioDevice(
    const std::string& current_device_id) {}

MediaItemUIDeviceSelectorView::~MediaItemUIDeviceSelectorView() {}

void MediaItemUIDeviceSelectorView::UpdateAvailableAudioDevices(
    const media::AudioDeviceDescriptions& device_descriptions) {}

void MediaItemUIDeviceSelectorView::SetMediaItemUIView(
    global_media_controls::MediaItemUIView* view) {}

void MediaItemUIDeviceSelectorView::OnColorsChanged(SkColor foreground_color,
                                                    SkColor background_color) {}

SkColor
MediaItemUIDeviceSelectorView::GetIconLabelBubbleSurroundingForegroundColor()
    const {}

SkColor MediaItemUIDeviceSelectorView::GetIconLabelBubbleBackgroundColor()
    const {}

void MediaItemUIDeviceSelectorView::ShowDevices() {}

void MediaItemUIDeviceSelectorView::HideDevices() {}

void MediaItemUIDeviceSelectorView::UpdateVisibility() {}

bool MediaItemUIDeviceSelectorView::ShouldBeVisible() const {}

void MediaItemUIDeviceSelectorView::CreateExpandButtonStrip(
    bool show_expand_button) {}

void MediaItemUIDeviceSelectorView::ShowOrHideDeviceList() {}

void MediaItemUIDeviceSelectorView::UpdateIsAudioDeviceSwitchingEnabled(
    bool enabled) {}

void MediaItemUIDeviceSelectorView::RemoveDevicesOfType(
    DeviceEntryUIType type) {}

DeviceEntryUI* MediaItemUIDeviceSelectorView::GetDeviceEntryUI(
    views::View* view) const {}

void MediaItemUIDeviceSelectorView::OnDevicesUpdated(
    std::vector<global_media_controls::mojom::DevicePtr> devices) {}

void MediaItemUIDeviceSelectorView::OnDeviceSelected(int tag) {}

void MediaItemUIDeviceSelectorView::OnDropdownButtonClicked() {}

bool MediaItemUIDeviceSelectorView::IsDeviceSelectorExpanded() {}

bool MediaItemUIDeviceSelectorView::OnMousePressed(
    const ui::MouseEvent& event) {}

gfx::Size MediaItemUIDeviceSelectorView::CalculatePreferredSize(
    const views::SizeBounds& available_size) const {}

void MediaItemUIDeviceSelectorView::AddObserver(
    MediaItemUIDeviceSelectorObserver* observer) {}

views::Label*
MediaItemUIDeviceSelectorView::GetExpandDeviceSelectorLabelForTesting() {}

views::Button* MediaItemUIDeviceSelectorView::GetDropdownButtonForTesting() {}

std::string MediaItemUIDeviceSelectorView::GetEntryLabelForTesting(
    views::View* entry_view) {}

bool MediaItemUIDeviceSelectorView::GetEntryIsHighlightedForTesting(
    views::View* entry_view) {}

bool MediaItemUIDeviceSelectorView::GetDeviceEntryViewVisibilityForTesting() {}

std::vector<CastDeviceEntryView*>
MediaItemUIDeviceSelectorView::GetCastDeviceEntryViewsForTesting() {}

void MediaItemUIDeviceSelectorView::OnCastDeviceSelected(
    const std::string& device_id) {}

void MediaItemUIDeviceSelectorView::RegisterAudioDeviceCallbacks() {}

BEGIN_METADATA()