#include "chrome/browser/ui/views/desktop_capture/desktop_media_pane_view.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/compositor/layer.h"
#include "ui/views/background.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/controls/separator.h"
#if BUILDFLAG(IS_MAC)
#include "chrome/browser/ui/views/desktop_capture/desktop_media_permission_pane_view_mac.h"
#endif
DesktopMediaPaneView::DesktopMediaPaneView(
DesktopMediaList::Type type,
std::unique_ptr<views::View> content_view,
std::unique_ptr<ShareAudioView> share_audio_view)
: … { … }
DesktopMediaPaneView::~DesktopMediaPaneView() = default;
bool DesktopMediaPaneView::AudioOffered() const { … }
bool DesktopMediaPaneView::IsAudioSharingApprovedByUser() const { … }
void DesktopMediaPaneView::SetAudioSharingApprovedByUser(bool is_on) { … }
std::u16string DesktopMediaPaneView::GetAudioLabelText() const { … }
bool DesktopMediaPaneView::IsPermissionPaneVisible() const { … }
bool DesktopMediaPaneView::IsContentPaneVisible() const { … }
#if BUILDFLAG(IS_MAC)
void DesktopMediaPaneView::OnScreenCapturePermissionUpdate(
bool has_permission) {
if (!PermissionRequired()) {
return;
}
if (!has_permission && !permission_pane_view_) {
MakePermissionPaneView();
}
if (permission_pane_view_) {
content_pane_view_->SetVisible(has_permission);
permission_pane_view_->SetVisible(!has_permission);
}
}
bool DesktopMediaPaneView::WasPermissionButtonClicked() const {
return permission_pane_view_ &&
permission_pane_view_->WasPermissionButtonClicked();
}
bool DesktopMediaPaneView::PermissionRequired() const {
switch (type_) {
case DesktopMediaList::Type::kScreen:
case DesktopMediaList::Type::kWindow:
return true;
case DesktopMediaList::Type::kNone:
case DesktopMediaList::Type::kWebContents:
case DesktopMediaList::Type::kCurrentTab:
return false;
}
NOTREACHED();
}
void DesktopMediaPaneView::MakePermissionPaneView() {
CHECK(!permission_pane_view_);
permission_pane_view_ =
AddChildView(std::make_unique<DesktopMediaPermissionPaneViewMac>(type_));
layout_->SetFlexForView(permission_pane_view_, 1);
}
#endif
BEGIN_METADATA(…)