bromite/build/patches/Disable-media-router-and-remoting-by-default.patch
2021-01-26 01:12:38 +01:00

66 lines
2.9 KiB
Diff

From: Daniel Micay <danielmicay@gmail.com>
Date: Thu, 4 Jul 2019 19:08:52 -0400
Subject: Disable media router and remoting by default
---
.../media/router/media_router_feature.cc | 17 ++++++++---------
chrome/browser/profiles/profile.cc | 2 +-
chrome/browser/profiles/profile_impl.cc | 2 +-
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/chrome/browser/media/router/media_router_feature.cc b/chrome/browser/media/router/media_router_feature.cc
--- a/chrome/browser/media/router/media_router_feature.cc
+++ b/chrome/browser/media/router/media_router_feature.cc
@@ -66,17 +66,16 @@ bool MediaRouterEnabled(content::BrowserContext* context) {
#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.
- if (pref->IsManaged() && !pref->IsDefaultValue()) {
- bool allowed = false;
- CHECK(pref->GetValue()->GetAsBoolean(&allowed));
- return allowed;
- }
-
// The component extension cannot be loaded in guest sessions.
// TODO(crbug.com/756243): Figure out why.
- return !Profile::FromBrowserContext(context)->IsGuestSession();
+ if (Profile::FromBrowserContext(context)->IsGuestSession()) {
+ return false;
+ }
+
+ const PrefService::Preference* pref = GetMediaRouterPref(context);
+ bool allowed = false;
+ pref->GetValue()->GetAsBoolean(&allowed);
+ return allowed;
#else // !(defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS))
return false;
#endif // defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -356,7 +356,7 @@ void Profile::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
media_router::prefs::kMediaRouterEnableCloudServices, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterBooleanPref(
- media_router::prefs::kMediaRouterMediaRemotingEnabled, true);
+ media_router::prefs::kMediaRouterMediaRemotingEnabled, false);
registry->RegisterListPref(
media_router::prefs::kMediaRouterTabMirroringSources);
#endif
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -409,7 +409,7 @@ void ProfileImpl::RegisterProfilePrefs(
#endif
registry->RegisterBooleanPref(prefs::kForceEphemeralProfiles, false);
- registry->RegisterBooleanPref(prefs::kEnableMediaRouter, true);
+ registry->RegisterBooleanPref(prefs::kEnableMediaRouter, false);
#if defined(OS_CHROMEOS)
registry->RegisterBooleanPref(
prefs::kOobeMarketingOptInScreenFinished, false,
--
2.17.1