Commit e3649abd authored by Dominic Mazzoni's avatar Dominic Mazzoni Committed by Commit Bot

Add a command-line switch to disable the media router

This is useful for local development, because the media router opens up
a local port and that triggers a permission dialog on macOS.

Bug: 1111418
Change-Id: I9da8167d77615bce7840ff82723260a951671eb7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2330007Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Reviewed-by: default avatarTakumi Fujimoto <takumif@chromium.org>
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795252}
parent 023ea721
......@@ -30,6 +30,13 @@
namespace media_router {
#if !defined(OS_ANDROID)
#if !defined(OFFICIAL_BUILD)
// Enables the media router. Can be useful to disable for local
// development on Mac because DIAL local discovery opens a local port
// and triggers a permission prompt. Only toggleable for developer builds.
const base::Feature kMediaRouter{"MediaRouter",
base::FEATURE_ENABLED_BY_DEFAULT};
#endif // !defined(OFFICIAL_BUILD)
// Controls if browser side DialMediaRouteProvider is enabled.
const base::Feature kDialMediaRouteProvider{"DialMediaRouteProvider",
base::FEATURE_ENABLED_BY_DEFAULT};
......@@ -39,7 +46,7 @@ const base::Feature kCastAllowAllIPsFeature{"CastAllowAllIPs",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kGlobalMediaControlsCastStartStop{
"GlobalMediaControlsCastStartStop", base::FEATURE_DISABLED_BY_DEFAULT};
#endif
#endif // !defined(OS_ANDROID)
#if defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
namespace {
......@@ -52,6 +59,11 @@ const PrefService::Preference* GetMediaRouterPref(
#endif // defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
bool MediaRouterEnabled(content::BrowserContext* context) {
#if !defined(OFFICIAL_BUILD) && !defined(OS_ANDROID)
if (!base::FeatureList::IsEnabled(kMediaRouter))
return false;
#endif // !defined(OFFICIAL_BUILD) && !defined(OS_ANDROID)
#if defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
const PrefService::Preference* pref = GetMediaRouterPref(context);
// Only use the pref value if it set from a mandatory policy.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment