diff --git a/chrome/browser/media/router/BUILD.gn b/chrome/browser/media/router/BUILD.gn index 18c600096deadd..7c50e58ee2160f 100644 --- a/chrome/browser/media/router/BUILD.gn +++ b/chrome/browser/media/router/BUILD.gn @@ -44,6 +44,7 @@ static_library("media_router_feature") { public_deps = [ "//base" ] deps = [ "//chrome/browser/profiles", + "//chrome/browser/profiles:profile", "//chrome/common:constants", "//components/media_router/common:common", "//components/prefs:prefs", diff --git a/chrome/browser/media/router/media_router_feature.cc b/chrome/browser/media/router/media_router_feature.cc index b215648cdac700..516be25ee310ab 100644 --- a/chrome/browser/media/router/media_router_feature.cc +++ b/chrome/browser/media/router/media_router_feature.cc @@ -17,6 +17,7 @@ #include "base/strings/string_util.h" #include "build/build_config.h" #include "chrome/browser/profiles/incognito_helpers.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" #include "components/media_router/common/pref_names.h" #include "components/prefs/pref_service.h" @@ -31,6 +32,10 @@ #include "components/prefs/pref_registry_simple.h" #endif +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/profiles/profile_types_ash.h" +#endif + namespace media_router { #if BUILDFLAG(IS_ANDROID) @@ -85,6 +90,12 @@ bool MediaRouterEnabled(content::BrowserContext* context) { if (!base::FeatureList::IsEnabled(kMediaRouter)) return false; #endif // !BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_CHROMEOS_ASH) + // TODO(crbug.com/1380828): Make the Media Router feature configurable via a + // policy for non-user profiles, i.e. sign-in and lock screen profiles. + if (!IsUserProfile(Profile::FromBrowserContext(context))) + return false; +#endif // BUILDFLAG(IS_CHROMEOS_ASH) // The MediaRouter service is shared across the original and the incognito // profiles, so we must use the original context for consistency between them.