chrome://devices: Replace content with a deprecation warning
Cloud and privet printing are being deprecated at the end of December.
Remove chrome://devices, since it is used for adding new cloud and
privet printers.
- Help center link is still TBD, but should be available shortly.
- Legacy page can be restored temporarily using a new flag added
in this CL, ForceEnableDevicesPage, to be deleted in M88.
Bug: 1114186
Change-Id: I662e195223c64ffe50df96d0512371ef0ebb0345
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343952
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796676}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index fa71d01..37cbe4b 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -2777,6 +2777,10 @@
ENABLE_DISABLE_VALUE_TYPE(switches::kEnableDeviceDiscoveryNotifications,
switches::kDisableDeviceDiscoveryNotifications)},
#endif // BUILDFLAG(ENABLE_SERVICE_DISCOVERY)
+ {"force-enable-devices-page",
+ flag_descriptions::kForceEnableDevicesPageName,
+ flag_descriptions::kForceEnableDevicesPageDescription, kOsDesktop,
+ FEATURE_VALUE_TYPE(features::kForceEnableDevicesPage)},
#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS)
{"enable-webgl2-compute-context",
flag_descriptions::kWebGL2ComputeContextName,
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 6a77bf40..badf56a 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -151,6 +151,7 @@
<if expr="enable_service_discovery">
<include name="IDR_LOCAL_DISCOVERY_HTML" file="resources\local_discovery\local_discovery.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
+ <include name="IDR_LOCAL_DISCOVERY_WARNING_HTML" file="resources\local_discovery\local_discovery_warning.html" type="BINDATA" />
<include name="IDR_LOCAL_DISCOVERY_CSS" file="resources\local_discovery\local_discovery.css" flattenhtml="true" type="BINDATA" />
<include name="IDR_LOCAL_DISCOVERY_JS" file="resources\local_discovery\local_discovery.js" flattenhtml="true" type="BINDATA" />
</if>
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index e546ac0..5c22de0 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -2503,6 +2503,11 @@
"expiry_milestone": 89
},
{
+ "name": "force-enable-devices-page",
+ "owners": [ "thestig", "rbpotter", "dhoss" ],
+ "expiry_milestone": 88
+ },
+ {
"name": "force-preferred-interval-for-video",
"owners": [ "khushalsagar" ],
"expiry_milestone": 89
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 84b9486..d92299a 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -504,6 +504,12 @@
const char kDeviceDiscoveryNotificationsDescription[] =
"Device discovery notifications on local network.";
+const char kForceEnableDevicesPageName[] = "Force enable chrome://devices page";
+const char kForceEnableDevicesPageDescription[] =
+ "With this flag on, the chrome://devices page will show its previous "
+ "content, instead of a warning message. Note: chrome://devices is "
+ "no longer supported, and this flag will be permanently removed in M88.";
+
const char kDisableBestEffortTasksName[] = "Skip best effort tasks";
const char kDisableBestEffortTasksDescription[] =
"With this flag on, tasks of the lowest priority will not be executed "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 593cf64..7b2f8a1 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -312,6 +312,9 @@
extern const char kDeviceDiscoveryNotificationsName[];
extern const char kDeviceDiscoveryNotificationsDescription[];
+extern const char kForceEnableDevicesPageName[];
+extern const char kForceEnableDevicesPageDescription[];
+
extern const char kDisableBestEffortTasksName[];
extern const char kDisableBestEffortTasksDescription[];
diff --git a/chrome/browser/resources/local_discovery/local_discovery_warning.html b/chrome/browser/resources/local_discovery/local_discovery_warning.html
new file mode 100644
index 0000000..b94695fe5
--- /dev/null
+++ b/chrome/browser/resources/local_discovery/local_discovery_warning.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html dir="$i18n{textdirection}" lang="$i18n{language}">
+<head>
+ <meta charset="utf-8">
+ <title>$i18n{devicesTitle}</title>
+ <link rel="stylesheet" href="chrome://resources/css/chrome_shared.css">
+</head>
+<style>
+ body {
+ margin: 21px 10px 24px 10px;
+ }
+
+ h1 {
+ margin: 0 0 13px 0;
+ }
+
+ header {
+ border-bottom: 1px solid #eee;
+ max-width: 718px;
+ }
+
+ div {
+ margin-top: 23px;
+ }
+</style>
+<body>
+ <header>
+ <h1>$i18n{devicesTitle}</h1>
+ </header>
+ <div>$i18nRaw{cloudPrintDeprecationWarning}</div>
+</body>
+</html>
diff --git a/chrome/browser/ui/ui_features.cc b/chrome/browser/ui/ui_features.cc
index 3db0665..130fc24 100644
--- a/chrome/browser/ui/ui_features.cc
+++ b/chrome/browser/ui/ui_features.cc
@@ -21,6 +21,10 @@
const base::Feature kExtensionsToolbarMenu{"ExtensionsToolbarMenu",
base::FEATURE_ENABLED_BY_DEFAULT};
+// Force enables the legacy chrome://devices page. To be removed in M88.
+const base::Feature kForceEnableDevicesPage{"ForceEnableDevicesPage",
+ base::FEATURE_DISABLED_BY_DEFAULT};
+
// Enables tabs from different browser types (NORMAL vs APP) and different apps
// to mix via dragging.
// https://crbug.com/1012169
diff --git a/chrome/browser/ui/ui_features.h b/chrome/browser/ui/ui_features.h
index 009798c9..de85992 100644
--- a/chrome/browser/ui/ui_features.h
+++ b/chrome/browser/ui/ui_features.h
@@ -26,6 +26,8 @@
extern const base::Feature kExtensionsToolbarMenu;
+extern const base::Feature kForceEnableDevicesPage;
+
extern const base::Feature kMixBrowserTypeTabs;
extern const base::Feature kNewProfilePicker;
diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui.cc b/chrome/browser/ui/webui/local_discovery/local_discovery_ui.cc
index 79d76f9a..bd40e88 100644
--- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui.cc
+++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui.cc
@@ -8,6 +8,7 @@
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h"
#include "chrome/browser/ui/webui/metrics_handler.h"
#include "chrome/browser/ui/webui/webui_util.h"
@@ -22,8 +23,42 @@
#include "printing/buildflags/buildflags.h"
#include "ui/base/webui/web_ui_util.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_process_platform_part.h"
+#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
+#elif defined(OS_WIN)
+#include "base/enterprise_util.h"
+#endif
+
namespace {
+content::WebUIDataSource* CreateLocalDiscoveryWarningHTMLSource() {
+ content::WebUIDataSource* source =
+ content::WebUIDataSource::Create(chrome::kChromeUIDevicesHost);
+
+ source->SetDefaultResource(IDR_LOCAL_DISCOVERY_WARNING_HTML);
+ source->AddLocalizedString("devicesTitle",
+ IDS_LOCAL_DISCOVERY_DEVICES_PAGE_TITLE);
+
+ bool enterprise_managed = false;
+#if defined(OS_CHROMEOS)
+ policy::BrowserPolicyConnectorChromeOS* connector =
+ g_browser_process->platform_part()->browser_policy_connector_chromeos();
+ enterprise_managed = connector->IsEnterpriseManaged();
+#elif defined(OS_WIN)
+ enterprise_managed = base::IsMachineExternallyManaged();
+#endif
+ source->AddLocalizedString(
+ "cloudPrintDeprecationWarning",
+ enterprise_managed ? IDS_CLOUD_PRINTING_NOT_SUPPORTED_WARNING_ENTERPRISE
+ : IDS_CLOUD_PRINTING_NOT_SUPPORTED_WARNING);
+
+ source->DisableDenyXFrameOptions();
+
+ return source;
+}
+
content::WebUIDataSource* CreateLocalDiscoveryHTMLSource() {
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIDevicesHost);
@@ -93,10 +128,19 @@
LocalDiscoveryUI::LocalDiscoveryUI(content::WebUI* web_ui)
: WebUIController(web_ui) {
+ const bool use_legacy_page =
+ base::FeatureList::IsEnabled(features::kForceEnableDevicesPage);
// Set up the chrome://devices/ source.
- content::WebUIDataSource* source = CreateLocalDiscoveryHTMLSource();
+ content::WebUIDataSource* source =
+ use_legacy_page ? CreateLocalDiscoveryHTMLSource()
+ : CreateLocalDiscoveryWarningHTMLSource();
+
content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
+ if (!use_legacy_page) {
+ return;
+ }
+
// TODO(gene): Use LocalDiscoveryUIHandler to send updated to the devices
// page. For example
web_ui->AddMessageHandler(
diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc
index 40ac82d..66785ec 100644
--- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/signin/chrome_signin_client_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@@ -355,8 +356,9 @@
// presence of a valid DualMediaSinkService.
// TODO(crbug.com/1028753): Enable the Media Route Provider features.
feature_list_.InitWithFeatures(
- {}, /* disabled_features */ {media_router::kDialMediaRouteProvider,
- media_router::kCastMediaRouteProvider});
+ /* enabled_features */ {features::kForceEnableDevicesPage},
+ /* disabled_features */ {media_router::kDialMediaRouteProvider,
+ media_router::kCastMediaRouteProvider});
WebUIBrowserTest::SetUp();
}
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index 5295db0e..dbfd7fd 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -40484,6 +40484,7 @@
<int value="-1567727398" label="DesktopPWAsWithoutExtensions:disabled"/>
<int value="-1564232131"
label="OmniboxOnDeviceHeadProviderNonIncognito:enabled"/>
+ <int value="-1562065709" label="ForceEnableDevicesPage:enabled"/>
<int value="-1561360053" label="LauncherSettingsSearch:disabled"/>
<int value="-1561252720" label="AutofillCreditCardUploadFeedback:disabled"/>
<int value="-1560729847" label="AutofillCacheQueryResponses:enabled"/>
@@ -43277,6 +43278,7 @@
<int value="1393722373" label="SaveEditedPDFForm:disabled"/>
<int value="1397069250" label="NetworkService:disabled"/>
<int value="1398148960" label="LanguageSettingsUpdate:disabled"/>
+ <int value="1398333721" label="ForceEnableDevicesPage:disabled"/>
<int value="1399950951" label="AutofillTokenPrefixMatching:disabled"/>
<int value="1403195370" label="ArcCupsApi:enabled"/>
<int value="1405459667" label="enable-fast-text-autosizing"/>