Make ScreenCastPortal::CaptureSourceType private
https://crrev.com/c/3885576 removed the last downstream consumer of the constructor which took a ScreenCastPortal::CaptureSourceType. Now that it has been removed, that constructor definition can also be removed and the CaptureSourceType enum can be made private. There's still benefit in storing and using this internally as the enum, since it's values match that of the underlying system API. The previously anonymous-namespaced function |ToCaptureSourceType| had to be converted to a private static method as part of this change, since it would be unable to access the type otherwise. Fixed: chromium:1359411 Change-Id: I81ff24fbdddf9db02c9c5152d007dd82c194865a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/274680 Auto-Submit: Alexander Cooper <alcooper@chromium.org> Commit-Queue: Alexander Cooper <alcooper@chromium.org> Commit-Queue: Mark Foltz <mfoltz@chromium.org> Reviewed-by: Mark Foltz <mfoltz@chromium.org> Cr-Commit-Position: refs/heads/main@{#38084}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
024bd84ca1
commit
ca27f1a1a0
@ -31,7 +31,11 @@ using xdg_portal::StartSessionRequest;
|
||||
using xdg_portal::TearDownSession;
|
||||
using xdg_portal::RequestResponseFromPortalResponse;
|
||||
|
||||
ScreenCastPortal::CaptureSourceType ToCaptureSourceType(CaptureType type) {
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
ScreenCastPortal::CaptureSourceType ScreenCastPortal::ToCaptureSourceType(
|
||||
CaptureType type) {
|
||||
switch (type) {
|
||||
case CaptureType::kScreen:
|
||||
return ScreenCastPortal::CaptureSourceType::kScreen;
|
||||
@ -40,22 +44,6 @@ ScreenCastPortal::CaptureSourceType ToCaptureSourceType(CaptureType type) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(https://crbug.com/1359411): Migrate downstream consumers off of
|
||||
// CaptureSourceType and delete this.
|
||||
CaptureType ToCaptureType(ScreenCastPortal::CaptureSourceType source_type) {
|
||||
switch (source_type) {
|
||||
case ScreenCastPortal::CaptureSourceType::kScreen:
|
||||
return CaptureType::kScreen;
|
||||
case ScreenCastPortal::CaptureSourceType::kWindow:
|
||||
return CaptureType::kWindow;
|
||||
default:
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return CaptureType::kScreen;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
ScreenCastPortal::ScreenCastPortal(CaptureType type, PortalNotifier* notifier)
|
||||
: ScreenCastPortal(type,
|
||||
notifier,
|
||||
@ -76,18 +64,6 @@ ScreenCastPortal::ScreenCastPortal(
|
||||
sources_request_response_signal_handler),
|
||||
user_data_(user_data) {}
|
||||
|
||||
ScreenCastPortal::ScreenCastPortal(
|
||||
CaptureSourceType source_type,
|
||||
PortalNotifier* notifier,
|
||||
ProxyRequestResponseHandler proxy_request_response_handler,
|
||||
SourcesRequestResponseSignalHandler sources_request_response_signal_handler,
|
||||
gpointer user_data)
|
||||
: ScreenCastPortal(ToCaptureType(source_type),
|
||||
notifier,
|
||||
proxy_request_response_handler,
|
||||
sources_request_response_signal_handler,
|
||||
user_data) {}
|
||||
|
||||
ScreenCastPortal::~ScreenCastPortal() {
|
||||
Stop();
|
||||
}
|
||||
|
||||
@ -38,16 +38,6 @@ class ScreenCastPortal : public xdg_portal::ScreenCapturePortalInterface {
|
||||
GVariant* parameters,
|
||||
gpointer user_data);
|
||||
|
||||
// Values are set based on source type property in
|
||||
// xdg-desktop-portal/screencast
|
||||
// https://github.com/flatpak/xdg-desktop-portal/blob/master/data/org.freedesktop.portal.ScreenCast.xml
|
||||
// TODO(https://crbug.com/1359411): Make this private.
|
||||
enum class CaptureSourceType : uint32_t {
|
||||
kScreen = 0b01,
|
||||
kWindow = 0b10,
|
||||
kAnyScreenContent = kScreen | kWindow
|
||||
};
|
||||
|
||||
// Values are set based on cursor mode property in
|
||||
// xdg-desktop-portal/screencast
|
||||
// https://github.com/flatpak/xdg-desktop-portal/blob/master/data/org.freedesktop.portal.ScreenCast.xml
|
||||
@ -96,14 +86,6 @@ class ScreenCastPortal : public xdg_portal::ScreenCapturePortalInterface {
|
||||
sources_request_response_signal_handler,
|
||||
gpointer user_data);
|
||||
|
||||
// TODO(https://crbug.com/1359411): Migrate downstream consumers off of
|
||||
// CaptureSourceType and delete this.
|
||||
ScreenCastPortal(CaptureSourceType source_type,
|
||||
PortalNotifier* notifier,
|
||||
ProxyRequestResponseHandler proxy_request_response_handler,
|
||||
SourcesRequestResponseSignalHandler
|
||||
sources_request_response_signal_handler,
|
||||
gpointer user_data);
|
||||
~ScreenCastPortal();
|
||||
|
||||
// Initialize ScreenCastPortal with series of DBus calls where we try to
|
||||
@ -136,6 +118,16 @@ class ScreenCastPortal : public xdg_portal::ScreenCapturePortalInterface {
|
||||
std::string RestoreToken() const;
|
||||
|
||||
private:
|
||||
// Values are set based on source type property in
|
||||
// xdg-desktop-portal/screencast
|
||||
// https://github.com/flatpak/xdg-desktop-portal/blob/master/data/org.freedesktop.portal.ScreenCast.xml
|
||||
enum class CaptureSourceType : uint32_t {
|
||||
kScreen = 0b01,
|
||||
kWindow = 0b10,
|
||||
kAnyScreenContent = kScreen | kWindow
|
||||
};
|
||||
static CaptureSourceType ToCaptureSourceType(CaptureType type);
|
||||
|
||||
PortalNotifier* notifier_;
|
||||
|
||||
// A PipeWire stream ID of stream we will be connecting to
|
||||
|
||||
Reference in New Issue
Block a user