forked from GrapheneOS/Vanadium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0024-disable-media-router-by-default.patch
63 lines (59 loc) · 2.63 KB
/
0024-disable-media-router-by-default.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From c4a30a8ced03d5b80e410fc7bb63086d3630cd3d Mon Sep 17 00:00:00 2001
From: Daniel Micay <[email protected]>
Date: Thu, 4 Jul 2019 19:08:52 -0400
Subject: [PATCH 24/48] disable media router by default
---
.../media/router/media_router_feature.cc | 19 +++++++++----------
chrome/browser/profiles/profile_impl.cc | 2 +-
2 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
index 13f8c0149911..c0fc552533a7 100644
--- a/chrome/browser/media/router/media_router_feature.cc
+++ b/chrome/browser/media/router/media_router_feature.cc
@@ -51,23 +51,22 @@ const PrefService::Preference* GetMediaRouterPref(
content::BrowserContext* context) {
return user_prefs::UserPrefs::Get(context)->FindPreference(
::prefs::kEnableMediaRouter);
-}
+ }
} // namespace
#endif // defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
bool MediaRouterEnabled(content::BrowserContext* context) {
#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_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 084648e9606f..8eae19f81d76 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -437,7 +437,7 @@ void ProfileImpl::RegisterProfilePrefs(
registry->RegisterStringPref(
prefs::kPrintPreviewDefaultDestinationSelectionRules, std::string());
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.23.0