#include "chrome/browser/ui/views/desktop_capture/desktop_media_list_view.h"
#include <algorithm>
#include <string>
#include <utility>
#include "base/ranges/algorithm.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/media/webrtc/desktop_media_list.h"
#include "chrome/browser/media/webrtc/window_icon_util.h"
#include "chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.h"
#include "chrome/browser/ui/views/desktop_capture/desktop_media_source_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/grit/theme_resources.h"
#include "extensions/grit/extensions_browser_resources.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/view_utils.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ui/aura/window.h"
#endif
DesktopMediaID;
namespace {
const int kDesktopMediaSourceViewGroupId = …;
#if BUILDFLAG(IS_CHROMEOS_ASH)
gfx::ImageSkia LoadDefaultIcon(aura::Window* window) {
BrowserView* browser_view =
BrowserView::GetBrowserViewForNativeWindow(window);
Browser* browser = browser_view ? browser_view->browser() : nullptr;
bool is_app =
!browser || browser->is_type_app() || browser->is_type_app_popup();
int idr = is_app ? IDR_APP_DEFAULT_ICON : IDR_PRODUCT_LOGO_32;
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
return *rb.GetImageSkiaNamed(idr);
}
#endif
DesktopMediaSourceView* AsDesktopMediaSourceView(views::View* view) { … }
}
DesktopMediaListView::DesktopMediaListView(
DesktopMediaListController* controller,
DesktopMediaSourceViewStyle generic_style,
DesktopMediaSourceViewStyle single_style,
const std::u16string& accessible_name)
: … { … }
DesktopMediaListView::~DesktopMediaListView() { … }
void DesktopMediaListView::OnSelectionChanged() { … }
gfx::Size DesktopMediaListView::CalculatePreferredSize(
const views::SizeBounds& ) const { … }
void DesktopMediaListView::Layout(PassKey) { … }
bool DesktopMediaListView::OnKeyPressed(const ui::KeyEvent& event) { … }
std::optional<content::DesktopMediaID> DesktopMediaListView::GetSelection() { … }
DesktopMediaListController::SourceListListener*
DesktopMediaListView::GetSourceListListener() { … }
void DesktopMediaListView::ClearSelection() { … }
void DesktopMediaListView::OnSourceAdded(size_t index) { … }
void DesktopMediaListView::OnSourceRemoved(size_t index) { … }
void DesktopMediaListView::OnSourceMoved(size_t old_index, size_t new_index) { … }
void DesktopMediaListView::OnSourceNameChanged(size_t index) { … }
void DesktopMediaListView::OnSourceThumbnailChanged(size_t index) { … }
void DesktopMediaListView::OnSourcePreviewChanged(size_t index) { … }
void DesktopMediaListView::OnDelegatedSourceListSelection() { … }
void DesktopMediaListView::SetStyle(DesktopMediaSourceViewStyle* style) { … }
DesktopMediaSourceView* DesktopMediaListView::GetSelectedView() { … }