Add CefMediaSink::GetIconType (see issue #2900)

This attribute is useful for identifying different classes of cast devices
without first requiring a connection (CAST, CAST_AUDIO, CAST_AUDIO_GROUP, etc).
This commit is contained in:
Marshall Greenblatt
2020-04-29 15:01:09 -04:00
parent 3afea627b4
commit 4e13d9991b
11 changed files with 126 additions and 16 deletions

View File

@@ -27,6 +27,15 @@ CefString CefMediaSinkImpl::GetDescription() {
return sink_.description().value_or("");
}
CefMediaSink::IconType CefMediaSinkImpl::GetIconType() {
// Verify that our enum matches Chromium's values.
static_assert(static_cast<int>(CEF_MSIT_TOTAL_COUNT) ==
static_cast<int>(media_router::SinkIconType::TOTAL_COUNT),
"enum mismatch");
return static_cast<CefMediaSink::IconType>(sink_.icon_type());
}
bool CefMediaSinkImpl::IsCastSink() {
return sink_.provider_id() == media_router::CAST;
}

View File

@@ -22,6 +22,7 @@ class CefMediaSinkImpl : public CefMediaSink {
bool IsValid() override;
CefString GetName() override;
CefString GetDescription() override;
IconType GetIconType() override;
bool IsCastSink() override;
bool IsDialSink() override;
bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) override;