Commit 40407da9 authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Commit Bot

Add local_discovery.enabled pref to control access to chrome://devices

The pref controls the local discovery UI (chrome://devices) which shows
discoverable devices near the user as well as cloud devices registered
to them. The page also allows for the adding of printers/devices, a
capability that administrators may want to restrict.

The pref defaults to true.

A future CL will add the policy configurations.

Bug: 1011582
Change-Id: I84a7ca5d22893b0a5cb0bf7948375ad8ef426288
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1975292Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726249}
parent eb5fc7e6
...@@ -685,7 +685,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui, ...@@ -685,7 +685,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
} }
#endif #endif
#if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
if (url.host_piece() == chrome::kChromeUIDevicesHost) { if (url.host_piece() == chrome::kChromeUIDevicesHost &&
profile->GetPrefs()->GetBoolean(prefs::kLocalDiscoveryEnabled)) {
return &NewWebUI<LocalDiscoveryUI>; return &NewWebUI<LocalDiscoveryUI>;
} }
#endif #endif
......
...@@ -105,6 +105,7 @@ LocalDiscoveryUI::LocalDiscoveryUI(content::WebUI* web_ui) ...@@ -105,6 +105,7 @@ LocalDiscoveryUI::LocalDiscoveryUI(content::WebUI* web_ui)
void LocalDiscoveryUI::RegisterProfilePrefs( void LocalDiscoveryUI::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) { user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(prefs::kLocalDiscoveryEnabled, true);
registry->RegisterBooleanPref( registry->RegisterBooleanPref(
prefs::kLocalDiscoveryNotificationsEnabled, prefs::kLocalDiscoveryNotificationsEnabled,
#if defined(OS_WIN) #if defined(OS_WIN)
......
...@@ -1394,6 +1394,10 @@ const char kMessageCenterDisabledExtensionIds[] = ...@@ -1394,6 +1394,10 @@ const char kMessageCenterDisabledExtensionIds[] =
// platforms. // platforms.
const char kFullscreenAllowed[] = "fullscreen.allowed"; const char kFullscreenAllowed[] = "fullscreen.allowed";
// Enable the local discovery UI (chrome://devices) which shows discoverable
// devices near the user as well as cloud devices registered to them.
const char kLocalDiscoveryEnabled[] = "local_discovery.enabled";
// Enable notifications for new devices on the local network that can be // Enable notifications for new devices on the local network that can be
// registered to the user's account, e.g. Google Cloud Print printers. // registered to the user's account, e.g. Google Cloud Print printers.
const char kLocalDiscoveryNotificationsEnabled[] = const char kLocalDiscoveryNotificationsEnabled[] =
......
...@@ -446,6 +446,7 @@ extern const char kMessageCenterDisabledExtensionIds[]; ...@@ -446,6 +446,7 @@ extern const char kMessageCenterDisabledExtensionIds[];
extern const char kFullscreenAllowed[]; extern const char kFullscreenAllowed[];
extern const char kLocalDiscoveryEnabled[];
extern const char kLocalDiscoveryNotificationsEnabled[]; extern const char kLocalDiscoveryNotificationsEnabled[];
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
......
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