#include "chrome/browser/ui/views/global_media_controls/cast_device_selector_view.h"
#include "base/metrics/histogram_functions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/ui/views/global_media_controls/media_item_ui_helper.h"
#include "chrome/browser/ui/views/global_media_controls/media_notification_device_entry_ui.h"
#include "chrome/grit/generated_resources.h"
#include "components/global_media_controls/public/views/media_item_ui_updated_view.h"
#include "components/media_router/browser/media_router_metrics.h"
#include "components/media_router/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/background.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/controls/throbber.h"
#include "ui/views/layout/box_layout_view.h"
#include "ui/views/view_class_properties.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/mac_util.h"
#endif
namespace {
constexpr gfx::Size kCloseButtonSize{ … };
constexpr int kBackgroundBorderThickness = …;
constexpr int kBackgroundCornerRadius = …;
constexpr int kDeviceEntryCornerRadius = …;
constexpr int kBackgroundSeparator = …;
constexpr int kDeviceContainerSeparator = …;
constexpr int kDeviceEntrySeparator = …;
constexpr int kCloseButtonIconSize = …;
constexpr int kDeviceEntryIconSize = …;
constexpr gfx::Insets kBackgroundInsets = …;
constexpr gfx::Insets kCastHeaderRowInsets = …;
constexpr gfx::Insets kIconHoverButtonInsets = …;
constexpr gfx::Insets kThrobberHoverButtonInsets = …;
}
IssueHoverButton::IssueHoverButton(PressedCallback callback,
global_media_controls::mojom::IconType icon,
const std::u16string& device_name,
const std::u16string& status_text,
ui::ColorId device_name_color_id,
ui::ColorId status_text_color_id)
: … { … }
gfx::Size IssueHoverButton::CalculatePreferredSize(
const views::SizeBounds& available_size) const { … }
BEGIN_METADATA(…)
CastDeviceSelectorView::CastDeviceSelectorView(
mojo::PendingRemote<global_media_controls::mojom::DeviceListHost>
device_list_host,
mojo::PendingReceiver<global_media_controls::mojom::DeviceListClient>
device_list_client,
media_message_center::MediaColorTheme media_color_theme,
bool show_devices)
: … { … }
CastDeviceSelectorView::~CastDeviceSelectorView() = default;
void CastDeviceSelectorView::SetMediaItemUIUpdatedView(
global_media_controls::MediaItemUIUpdatedView* view) { … }
void CastDeviceSelectorView::ShowDevices() { … }
void CastDeviceSelectorView::HideDevices() { … }
bool CastDeviceSelectorView::IsDeviceSelectorExpanded() { … }
void CastDeviceSelectorView::OnDevicesUpdated(
std::vector<global_media_controls::mojom::DevicePtr> devices) { … }
void CastDeviceSelectorView::OnPermissionRejected() { … }
std::unique_ptr<HoverButton> CastDeviceSelectorView::BuildCastDeviceEntryView(
views::Button::PressedCallback callback,
global_media_controls::mojom::IconType icon,
const std::u16string& device_name,
const std::u16string& status_text) { … }
void CastDeviceSelectorView::OnCastDeviceSelected(
const std::string& device_id) { … }
void CastDeviceSelectorView::UpdateVisibility() { … }
void CastDeviceSelectorView::CloseButtonPressed() { … }
bool CastDeviceSelectorView::IsDeviceSelectorAvailable() { … }
bool CastDeviceSelectorView::GetHasDeviceIssueForTesting() { … }
global_media_controls::MediaActionButton*
CastDeviceSelectorView::GetCloseButtonForTesting() { … }
views::View* CastDeviceSelectorView::GetDeviceContainerViewForTesting() { … }
views::View* CastDeviceSelectorView::GetPermissionRejectedViewForTesting() { … }
BEGIN_METADATA(…)