Commit ed5d04cf authored by Yann Dago's avatar Yann Dago Committed by Commit Bot

Added reporting info on chrome://management for desktop

Message added under Browsing Reporting section on Desktop
with "Chrome Reporting Extension (cloud or OnPrem)" installed
for each of the following policies:
  * report_machine_id_data (true for cloud reporting)
  * report_user_id_data (true for cloud reporting)
  * report_version_data (true for cloud reporting)
  * report_policy_data (true for cloud reporting)
  * report_extensions_data (true for cloud reporting)
  * report_safe_browsing_data (true for cloud reporting)
  * report_system_telemetry_data
  * report_user_browsing_data

Bug: 921698
Change-Id: Icccf744acb775be9723e38b61829ffb42fc2053c
Reviewed-on: https://chromium-review.googlesource.com/c/1423116
Commit-Queue: Yann Dago <ydago@chromium.org>
Reviewed-by: default avatarDan Beam (slow until 1/29) <dbeam@chromium.org>
Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625397}
parent b4754fc1
......@@ -37,6 +37,11 @@
<ul id="reporting-info-list"></ul>
</section>
<section id="browser-policies" hidden>
<h2 class="section-title">$i18n{browserReporting}</h2>
<ul id="browser-reporting-info-list"></ul>
</section>
<section id="extensions" hidden>
<h2 class="section-title">$i18n{extensionReporting}</h2>
<div id="extensions-installed">
......
......@@ -57,6 +57,22 @@ cr.define('management', function() {
$('reporting-info-list').appendChild(element);
}
});
// Show descriptions of the types of reporting in the |reportingSources|
// list.
this.browserProxy_.getBrowserReportingInfo().then(function(
reportingSources) {
if (reportingSources.length == 0) {
return;
}
$('browser-policies').hidden = false;
for (const id of reportingSources) {
const element = document.createElement('li');
element.textContent = loadTimeData.getString(id);
$('browser-reporting-info-list').appendChild(element);
}
});
// Show names and permissions of |extensions| in a table.
this.browserProxy_.getExtensions().then(function(extensions) {
......@@ -119,6 +135,11 @@ cr.define('management', function() {
*/
getReportingInfo() {}
/**
* @return {!Promise<!Array<string>>} List of reporting info.
*/
getBrowserReportingInfo() {}
/**
* Each extension has a name and a list of permission messages.
* @return {!Promise<!Array<!Extension>>} List of extensions.
......@@ -146,6 +167,11 @@ cr.define('management', function() {
return cr.sendWithPromise('getReportingInfo');
}
/** @override */
getBrowserReportingInfo() {
return cr.sendWithPromise('getBrowserReportingInfo');
}
/** @override */
getExtensions() {
return cr.sendWithPromise('getExtensions');
......
......@@ -12,6 +12,7 @@
#include "chrome/grit/browser_resources.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_ui.h"
#include "extensions/buildflags/buildflags.h"
namespace {
......@@ -21,6 +22,8 @@ content::WebUIDataSource* CreateManagementUIHtmlSource() {
source->AddLocalizedString("title", IDS_MANAGEMENT_TITLE);
source->AddLocalizedString("deviceReporting",
IDS_MANAGEMENT_DEVICE_REPORTING);
source->AddLocalizedString("browserReporting",
IDS_MANAGEMENT_BROWSER_REPORTING);
source->AddLocalizedString("deviceConfiguration",
IDS_MANAGEMENT_DEVICE_CONFIGURATION);
source->AddLocalizedString("extensionReporting",
......@@ -47,6 +50,31 @@ content::WebUIDataSource* CreateManagementUIHtmlSource() {
source->AddLocalizedString("managementDesktopMonitoringNotice",
IDS_MANAGEMENT_DESKTOP_MONITORING_NOTICE);
#if BUILDFLAG(ENABLE_EXTENSIONS)
source->AddLocalizedString(kManagementExtensionReportMachineName,
IDS_MANAGEMENT_EXTENSION_REPORT_MACHINE_NAME);
source->AddLocalizedString(
kManagementExtensionReportMachineNameAddress,
IDS_MANAGEMENT_EXTENSION_REPORT_MACHINE_NAME_ADDRESS);
source->AddLocalizedString(kManagementExtensionReportUsername,
IDS_MANAGEMENT_EXTENSION_REPORT_USERNAME);
source->AddLocalizedString(kManagementExtensionReportVersion,
IDS_MANAGEMENT_EXTENSION_REPORT_VERSION);
source->AddLocalizedString(kManagementExtensionReportPolicies,
IDS_MANAGEMENT_EXTENSION_REPORT_POLICIES);
source->AddLocalizedString(
kManagementExtensionReportExtensionsPlugin,
IDS_MANAGEMENT_EXTENSION_REPORT_EXTENSIONS_PLUGINS);
source->AddLocalizedString(
kManagementExtensionReportSafeBrowsingWarnings,
IDS_MANAGEMENT_EXTENSION_REPORT_SAFE_BROWSING_WARNINGS);
source->AddLocalizedString(kManagementExtensionReportPerfCrash,
IDS_MANAGEMENT_EXTENSION_REPORT_PERF_CRASH);
source->AddLocalizedString(
kManagementExtensionReportWebsiteUsageStatistics,
IDS_MANAGEMENT_EXTENSION_REPORT_WEBSITE_USAGE_STATISTICS);
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#if defined(OS_CHROMEOS)
source->AddLocalizedString("managementTrustRootsConfigured",
IDS_MANAGEMENT_TRUST_ROOTS_CONFIGURED);
......
......@@ -20,7 +20,6 @@
#include "chrome/browser/profiles/profile.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_contents.h"
#include "extensions/buildflags/buildflags.h"
#include "ui/base/l10n/l10n_util.h"
#if defined(OS_CHROMEOS)
......@@ -35,13 +34,37 @@
#endif // defined(OS_CHROMEOS)
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/common/extensions/permissions/chrome_permission_message_provider.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_namespace.h"
#include "components/policy/core/common/policy_service.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest.h"
#include "extensions/common/permissions/permission_message_provider.h"
#include "extensions/common/permissions/permissions_data.h"
const char kManagementExtensionReportMachineName[] =
"managementExtensionReportMachineName";
const char kManagementExtensionReportMachineNameAddress[] =
"managementExtensionReportMachineNameAddress";
const char kManagementExtensionReportUsername[] =
"managementExtensionReportUsername";
const char kManagementExtensionReportVersion[] =
"managementExtensionReportVersion";
const char kManagementExtensionReportPolicies[] =
"managementExtensionReportPolicies";
const char kManagementExtensionReportExtensionsPlugin[] =
"managementExtensionReportExtensionsPlugin";
const char kManagementExtensionReportSafeBrowsingWarnings[] =
"managementExtensionReportSafeBrowsingWarnings";
const char kManagementExtensionReportPerfCrash[] =
"managementExtensionReportPerfCrash";
const char kManagementExtensionReportWebsiteUsageStatistics[] =
"managementExtensionReportTimePerSite";
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
const char kManagementLogUploadEnabled[] = "managementLogUploadEnabled";
......@@ -213,6 +236,21 @@ void AddChromeOSReportingInfo(base::Value* report_sources) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
const char kOnPremReportingExtensionStableId[] =
"emahakmocgideepebncgnmlmliepgpgb";
const char kOnPremReportingExtensionBetaId[] =
"kigjhoekjcpdfjpimbdjegmgecmlicaf";
const char kCloudReportingExtensionId[] = "empjldejiginopiohodkdoklcjklbaa";
const char kPolicyKeyReportMachineIdData[] = "report_machine_id_data";
const char kPolicyKeyReportUserIdData[] = "report_user_id_data";
const char kPolicyKeyReportVersionData[] = "report_version_data";
const char kPolicyKeyReportPolicyData[] = "report_policy_data";
const char kPolicyKeyReportExtensionsData[] = "report_extensions_data";
const char kPolicyKeyReportSafeBrowsingData[] = "report_safe_browsing_data";
const char kPolicyKeyReportSystemTelemetryData[] =
"report_system_telemetry_data";
const char kPolicyKeyReportUserBrowsingData[] = "report_user_browsing_data";
std::vector<base::Value> GetPermissionsForExtension(
scoped_refptr<const extensions::Extension> extension) {
std::vector<base::Value> permission_messages;
......@@ -293,6 +331,10 @@ void ManagementUIHandler::RegisterMessages() {
"getReportingInfo",
base::BindRepeating(&ManagementUIHandler::HandleGetReportingInfo,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"getBrowserReportingInfo",
base::BindRepeating(&ManagementUIHandler::HandleGetBrowserReportingInfo,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"getExtensions",
base::BindRepeating(&ManagementUIHandler::HandleGetExtensions,
......@@ -405,6 +447,20 @@ void ManagementUIHandler::HandleGetReportingInfo(const base::ListValue* args) {
report_sources);
}
void ManagementUIHandler::HandleGetBrowserReportingInfo(
const base::ListValue* args) {
base::Value report_sources(base::Value::Type::LIST);
AllowJavascript();
// Only browsers with extensions enabled report status.
#if BUILDFLAG(ENABLE_EXTENSIONS)
AddExtensionReportingInfo(&report_sources);
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
ResolveJavascriptCallback(args->GetList()[0] /* callback_id */,
report_sources);
}
void ManagementUIHandler::HandleGetExtensions(const base::ListValue* args) {
AllowJavascript();
#if BUILDFLAG(ENABLE_EXTENSIONS)
......@@ -440,3 +496,83 @@ void ManagementUIHandler::HandleGetLocalTrustRootsInfo(
ResolveJavascriptCallback(args->GetList()[0] /* callback_id */,
trust_roots_configured);
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
void ManagementUIHandler::AddExtensionReportingInfo(
base::Value* report_sources) {
std::unordered_set<std::string> messages;
const extensions::Extension* cloud_reporting_extension =
extensions::ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))
->GetExtensionById(kCloudReportingExtensionId,
extensions::ExtensionRegistry::ENABLED);
if (cloud_reporting_extension != nullptr) {
messages.insert(kManagementExtensionReportMachineName);
messages.insert(kManagementExtensionReportUsername);
messages.insert(kManagementExtensionReportVersion);
messages.insert(kManagementExtensionReportPolicies);
messages.insert(kManagementExtensionReportExtensionsPlugin);
messages.insert(kManagementExtensionReportSafeBrowsingWarnings);
}
policy::PolicyNamespace on_prem_reporting_extension_stable_policy_namespace =
policy::PolicyNamespace(policy::POLICY_DOMAIN_EXTENSIONS,
kOnPremReportingExtensionStableId);
policy::PolicyNamespace on_prem_reporting_extension_beta_policy_namespace =
policy::PolicyNamespace(policy::POLICY_DOMAIN_EXTENSIONS,
kOnPremReportingExtensionBetaId);
const policy::PolicyService* policyService =
policy::ProfilePolicyConnectorFactory::GetForBrowserContext(
Profile::FromWebUI(web_ui()))
->policy_service();
const policy::PolicyMap& on_prem_reporting_extension_stable_policy_map =
policyService->GetPolicies(
on_prem_reporting_extension_stable_policy_namespace);
const policy::PolicyMap& on_prem_reporting_extension_beta_policy_map =
policyService->GetPolicies(
on_prem_reporting_extension_beta_policy_namespace);
const policy::PolicyMap* policy_maps[] = {
&on_prem_reporting_extension_stable_policy_map,
&on_prem_reporting_extension_beta_policy_map};
static const struct {
const char* policy_key;
const char* message;
} policy_keys_messages[] = {
{kPolicyKeyReportMachineIdData,
kManagementExtensionReportMachineNameAddress},
{kPolicyKeyReportUserIdData, kManagementExtensionReportUsername},
{kPolicyKeyReportVersionData, kManagementExtensionReportVersion},
{kPolicyKeyReportPolicyData, kManagementExtensionReportPolicies},
{kPolicyKeyReportExtensionsData,
kManagementExtensionReportExtensionsPlugin},
{kPolicyKeyReportSafeBrowsingData,
kManagementExtensionReportSafeBrowsingWarnings},
{kPolicyKeyReportSystemTelemetryData,
kManagementExtensionReportPerfCrash},
{kPolicyKeyReportUserBrowsingData,
kManagementExtensionReportWebsiteUsageStatistics}};
for (const auto* policy_map : policy_maps) {
for (const auto& policy_key_message : policy_keys_messages) {
const base::Value* policy_value =
policy_map->GetValue(policy_key_message.policy_key);
if (policy_value && policy_value->is_bool() && policy_value->GetBool())
messages.insert(policy_key_message.message);
}
}
if (messages.find(kManagementExtensionReportMachineNameAddress) !=
messages.end()) {
messages.erase(kManagementExtensionReportMachineName);
}
for (const auto& message : messages) {
report_sources->GetList().push_back(base::Value(message));
}
}
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
......@@ -10,6 +10,7 @@
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "extensions/buildflags/buildflags.h"
// Constants defining the IDs for the localized strings sent to the page as
// load time data.
......@@ -19,6 +20,18 @@ extern const char kManagementReportHardwareStatus[];
extern const char kManagementReportNetworkInterfaces[];
extern const char kManagementReportUsers[];
#if BUILDFLAG(ENABLE_EXTENSIONS)
extern const char kManagementExtensionReportMachineName[];
extern const char kManagementExtensionReportMachineNameAddress[];
extern const char kManagementExtensionReportUsername[];
extern const char kManagementExtensionReportVersion[];
extern const char kManagementExtensionReportPolicies[];
extern const char kManagementExtensionReportExtensionsPlugin[];
extern const char kManagementExtensionReportSafeBrowsingWarnings[];
extern const char kManagementExtensionReportPerfCrash[];
extern const char kManagementExtensionReportWebsiteUsageStatistics[];
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
namespace base {
class ListValue;
} // namespace base
......@@ -47,10 +60,16 @@ class ManagementUIHandler : public content::WebUIMessageHandler {
void HandleGetReportingInfo(const base::ListValue* args);
void HandleGetBrowserReportingInfo(const base::ListValue* args);
void HandleGetExtensions(const base::ListValue* args);
void HandleGetLocalTrustRootsInfo(const base::ListValue* args);
#if BUILDFLAG(ENABLE_EXTENSIONS)
void AddExtensionReportingInfo(base::Value* report_sources);
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
DISALLOW_COPY_AND_ASSIGN(ManagementUIHandler);
};
......
......@@ -21,6 +21,9 @@
<message name="IDS_MANAGEMENT_DEVICE_REPORTING" desc="Title of the types of device reporting section of the page" translateable="false">
Device reporting
</message>
<message name="IDS_MANAGEMENT_BROWSER_REPORTING" desc="Title of the types of browser reporting section of the page" translateable="false">
Browser reporting
</message>
<message name="IDS_MANAGEMENT_DEVICE_CONFIGURATION" desc="Message telling users that their administrator has set some specific policies on their device" translateable="false">
Your device has been configured to:
</message>
......@@ -62,6 +65,33 @@
<message name="IDS_MANAGEMENT_DESKTOP_MONITORING_NOTICE" desc="Message explaining that the administrators have ways to monitor users outside of chrome's control" translateable="false">
Administrators may have other ways of monitoring users, outside of Chrome.
</message>
<message name="IDS_MANAGEMENT_EXTENSION_REPORT_MACHINE_NAME" desc="Message explaining that an extension currently reports the user's machine name" translateable="false">
Report your machine's name
</message>
<message name="IDS_MANAGEMENT_EXTENSION_REPORT_MACHINE_NAME_ADDRESS" desc="Message explaining that an extension currently reports the user's machine name and address" translateable="false">
Report your machine's name and network address
</message>
<message name="IDS_MANAGEMENT_EXTENSION_REPORT_USERNAME" desc="Message explaining that an extension currently reports the user's username" translateable="false">
Report you OS and browser usernames
</message>
<message name="IDS_MANAGEMENT_EXTENSION_REPORT_VERSION" desc="Message explaining that an extension currently reports the user's browser and machine version" translateable="false">
Report software version information about your browser and machine
</message>
<message name="IDS_MANAGEMENT_EXTENSION_REPORT_POLICIES" desc="Message explaining that an extension currently reports the user's enterprise policies" translateable="false">
Report information about applied enterprise policies
</message>
<message name="IDS_MANAGEMENT_EXTENSION_REPORT_EXTENSIONS_PLUGINS" desc="Message explaining that an extension currently reports the user's exensions and plugins" translateable="false">
Report installed extensions and plugins
</message>
<message name="IDS_MANAGEMENT_EXTENSION_REPORT_SAFE_BROWSING_WARNINGS" desc="Message explaining that an extension currently reports the user's safe browsing warnings and ignored warnings" translateable="false">
Report Safe Browsing warnings
</message>
<message name="IDS_MANAGEMENT_EXTENSION_REPORT_PERF_CRASH" desc="Message explaining that an extension currently reports the user's performance data and crash report" translateable="false">
Report performance data and crash reports
</message>
<message name="IDS_MANAGEMENT_EXTENSION_REPORT_WEBSITE_USAGE_STATISTICS" desc="Message explaining that an extension currently reports the user's website usage statistics" translateable="false">
Report how much time you spend on each website
</message>
<if expr="chromeos">
<message name="IDS_MANAGEMENT_TRUST_ROOTS_CONFIGURED" desc="Message describing that the administrators have installed their own certificates" translateable="false">
Your account/device has been configured with local trust roots, which might allow administrators to see the contents of websites that you visit
......
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