Skip to content

Commit

Permalink
Disable Media Router for sign-in and lock screen profiles
Browse files Browse the repository at this point in the history
Media Router cannot be disabled for these profiles with per-profile admin policies so we'll blanket disable Media Router for them for now.

(cherry picked from commit 46aab5e)

Bug: 1380828
Change-Id: I79ddc952bdf74695a01d768eaf516fcb353b9e7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4113644
Reviewed-by: Muyao Xu <muyaoxu@google.com>
Commit-Queue: Takumi Fujimoto <takumif@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1084608}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4111812
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Takumi Fujimoto <takumif@chromium.org>
Reviewed-by: Takumi Fujimoto <takumif@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5481@{#18}
Cr-Branched-From: 130f3e4-refs/heads/main@{#1084008}
  • Loading branch information
takumif authored and Chromium LUCI CQ committed Dec 20, 2022
1 parent fb98f6d commit 15d7363
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions chrome/browser/media/router/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions chrome/browser/media/router/media_router_feature.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down Expand Up @@ -88,6 +93,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.
Expand Down

0 comments on commit 15d7363

Please sign in to comment.