Commit 61108ca1 authored by Yann Dago's avatar Yann Dago Committed by Commit Bot

Group reporting info by reporting type

Bug: 925931
Change-Id: Ie1b4f24d019d39743f1cb76241988d2b52d4920c
Reviewed-on: https://chromium-review.googlesource.com/c/1440223Reviewed-by: default avatarThiemo Nagel <tnagel@chromium.org>
Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Commit-Queue: Yann Dago <ydago@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632343}
parent e866b8bf
...@@ -11,6 +11,22 @@ cr.exportPath('management'); ...@@ -11,6 +11,22 @@ cr.exportPath('management');
*/ */
management.Extension; management.Extension;
/** @enum {string} */
management.ReportingType = {
SECURITY: 'security',
DEVICE: 'device',
USER: 'user',
EXTENSIONS: 'extensions'
};
/**
* @typedef {{
* messageId: string,
* reportingType: !management.ReportingType,
* }}
*/
management.BrowserReportingResponse;
cr.define('management', function() { cr.define('management', function() {
/** @interface */ /** @interface */
class ManagementBrowserProxy { class ManagementBrowserProxy {
...@@ -26,8 +42,8 @@ cr.define('management', function() { ...@@ -26,8 +42,8 @@ cr.define('management', function() {
// </if> // </if>
/** /**
* @return {!Promise<!Array<string>>} The list of browser reporting info * @return {!Promise<!Array<!management.BrowserReportingResponse>>} The list
* messages. * of browser reporting info messages.
*/ */
initBrowserReportingInfo() {} initBrowserReportingInfo() {}
} }
......
<link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/html/load_time_data.html"> <link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar.html"> <link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
<link rel="import" href="chrome://resources/html/load_time_data.html">
<link rel="import" href="management_browser_proxy.html"> <link rel="import" href="management_browser_proxy.html">
<dom-module id="management-ui"> <dom-module id="management-ui">
...@@ -61,8 +63,9 @@ ...@@ -61,8 +63,9 @@
} }
.browser-report { .browser-report {
align-items: center; align-items: start;
display: flex; display: flex;
margin: 12px 0;
} }
.single-column { .single-column {
...@@ -113,6 +116,10 @@ ...@@ -113,6 +116,10 @@
padding: 0; padding: 0;
} }
.browser-report ul {
margin: 0;
}
.list-item div { .list-item div {
padding: 0 5px 0; padding: 0 5px 0;
} }
...@@ -127,13 +134,20 @@ ...@@ -127,13 +134,20 @@
if="[[showBrowserReportingInfo_(browserReportingInfo_)]]"> if="[[showBrowserReportingInfo_(browserReportingInfo_)]]">
<section class="three-line single-column"> <section class="three-line single-column">
<h2>$i18n{browserReporting}</h2> <h2>$i18n{browserReporting}</h2>
<div class="content-indented browser-report"> <div class="content-indented subtitle">
<ul> $i18n{browserReportingExplanation}
<template is="dom-repeat" items="[[browserReportingInfo_]]">
<li>[[item]]</li>
</template>
</ul>
</div> </div>
<template is="dom-repeat" items="[[browserReportingInfo_]]">
<div class="content-indented browser-report">
<iron-icon icon="[[item.icon]]"></iron-icon>
<ul>
<template is="dom-repeat" items="[[item.messages]]"
as="message">
<li>[[message]]</li>
</template>
</ul>
</div>
</template>
</section> </section>
</template> </template>
<template is="dom-if" <template is="dom-if"
......
...@@ -2,13 +2,21 @@ ...@@ -2,13 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/**
* @typedef {{
* messages: !Array<string>,
* icon: string,
* }}
*/
management.BrowserReportingData;
Polymer({ Polymer({
is: 'management-ui', is: 'management-ui',
properties: { properties: {
/** /**
* List of messages related to browser reporting. * List of messages related to browser reporting.
* @private {?Array<string>} * @private {?Array<!management.BrowserReportingData>}
*/ */
browserReportingInfo_: Array, browserReportingInfo_: Array,
...@@ -57,12 +65,31 @@ Polymer({ ...@@ -57,12 +65,31 @@ Polymer({
}, },
/** /**
* @param {!Array<string>} reportingInfo * @param {!Array<!management.BrowserReportingResponse>} reportingInfo
* @private * @private
*/ */
onBrowserReportingInfoReceived_(reportingInfo) { onBrowserReportingInfoReceived_(reportingInfo) {
const reportingInfoMap = reportingInfo.reduce((info, response) => {
info[response.reportingType] = info[response.reportingType] || {
icon: this.getIconForReportingType_(response.reportingType),
messages: []
};
info[response.reportingType].messages.push(
loadTimeData.getString(response.messageId));
return info;
}, {});
const reportingTypeOrder = {
[management.ReportingType.SECURITY]: 1,
[management.ReportingType.EXTENSIONS]: 2,
[management.ReportingType.USER]: 3,
[management.ReportingType.DEVICE]: 4,
};
this.browserReportingInfo_ = this.browserReportingInfo_ =
reportingInfo.map(id => loadTimeData.getString(id)); Object.keys(reportingInfoMap)
.sort((a, b) => reportingTypeOrder[a] - reportingTypeOrder[b])
.map(reportingType => reportingInfoMap[reportingType]);
}, },
/** @private */ /** @private */
...@@ -99,4 +126,24 @@ Polymer({ ...@@ -99,4 +126,24 @@ Polymer({
showExtensionReportingInfo_() { showExtensionReportingInfo_() {
return !!this.extensions_ && this.extensions_.length > 0; return !!this.extensions_ && this.extensions_.length > 0;
}, },
/**
* @param {management.ReportingType} reportingType
* @returns {string} The associated icon.
* @private
*/
getIconForReportingType_(reportingType) {
switch (reportingType) {
case management.ReportingType.SECURITY:
return 'cr:security';
case management.ReportingType.DEVICE:
return 'cr:computer';
case management.ReportingType.EXTENSIONS:
return 'cr:extension';
case management.ReportingType.USER:
return 'cr:person';
default:
return 'cr:security';
}
},
}); });
...@@ -123,7 +123,7 @@ Polymer({ ...@@ -123,7 +123,7 @@ Polymer({
getDeviceIcon_: function(device) { getDeviceIcon_: function(device) {
switch (device.type) { switch (device.type) {
case 'computer': case 'computer':
return 'settings:computer'; return 'cr:computer';
case 'phone': case 'phone':
return 'settings:smartphone'; return 'settings:smartphone';
case 'audio': case 'audio':
......
...@@ -84,9 +84,6 @@ List icons here rather than importing large sets of (e.g. Polymer) icons. ...@@ -84,9 +84,6 @@ List icons here rather than importing large sets of (e.g. Polymer) icons.
<g id="clipboard"><path d="M19 2h-4.18C14.4.84 13.3 0 12 0c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z"></path></g> <g id="clipboard"><path d="M19 2h-4.18C14.4.84 13.3 0 12 0c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z"></path></g>
<g id="cloud"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"></path></g> <g id="cloud"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"></path></g>
<g id="code"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"></path></g> <g id="code"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"></path></g>
<if expr="chromeos">
<g id="computer"><path d="M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z"></path></g>
</if>
<g id="content-copy"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"></path></g> <g id="content-copy"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"></path></g>
<if expr="chromeos"> <if expr="chromeos">
<g id="devices-other"><path d="M3 6h18V4H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4v-2H3V6zm10 6H9v1.78c-.61.55-1 1.33-1 2.22s.39 1.67 1 2.22V20h4v-1.78c.61-.55 1-1.34 1-2.22s-.39-1.67-1-2.22V12zm-2 5.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM22 8h-6c-.5 0-1 .5-1 1v10c0 .5.5 1 1 1h6c.5 0 1-.5 1-1V9c0-.5-.5-1-1-1zm-1 10h-4v-8h4v8z"></path></g> <g id="devices-other"><path d="M3 6h18V4H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4v-2H3V6zm10 6H9v1.78c-.61.55-1 1.33-1 2.22s.39 1.67 1 2.22V20h4v-1.78c.61-.55 1-1.34 1-2.22s-.39-1.67-1-2.22V12zm-2 5.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM22 8h-6c-.5 0-1 .5-1 1v10c0 .5.5 1 1 1h6c.5 0 1-.5 1-1V9c0-.5-.5-1-1-1zm-1 10h-4v-8h4v8z"></path></g>
......
...@@ -24,6 +24,8 @@ content::WebUIDataSource* CreateManagementUIHtmlSource() { ...@@ -24,6 +24,8 @@ content::WebUIDataSource* CreateManagementUIHtmlSource() {
IDS_MANAGEMENT_DEVICE_REPORTING); IDS_MANAGEMENT_DEVICE_REPORTING);
source->AddLocalizedString("browserReporting", source->AddLocalizedString("browserReporting",
IDS_MANAGEMENT_BROWSER_REPORTING); IDS_MANAGEMENT_BROWSER_REPORTING);
source->AddLocalizedString("browserReportingExplanation",
IDS_MANAGEMENT_BROWSER_REPORTING_EXPLANATION);
source->AddLocalizedString("deviceConfiguration", source->AddLocalizedString("deviceConfiguration",
IDS_MANAGEMENT_DEVICE_CONFIGURATION); IDS_MANAGEMENT_DEVICE_CONFIGURATION);
source->AddLocalizedString("extensionReporting", source->AddLocalizedString("extensionReporting",
...@@ -66,14 +68,15 @@ content::WebUIDataSource* CreateManagementUIHtmlSource() { ...@@ -66,14 +68,15 @@ content::WebUIDataSource* CreateManagementUIHtmlSource() {
source->AddLocalizedString( source->AddLocalizedString(
kManagementExtensionReportExtensionsPlugin, kManagementExtensionReportExtensionsPlugin,
IDS_MANAGEMENT_EXTENSION_REPORT_EXTENSIONS_PLUGINS); IDS_MANAGEMENT_EXTENSION_REPORT_EXTENSIONS_PLUGINS);
source->AddLocalizedString(
kManagementExtensionReportExtensionsAndPolicies,
IDS_MANAGEMENT_EXTENSION_REPORT_EXTENSIONS_AND_POLICIES);
source->AddLocalizedString( source->AddLocalizedString(
kManagementExtensionReportSafeBrowsingWarnings, kManagementExtensionReportSafeBrowsingWarnings,
IDS_MANAGEMENT_EXTENSION_REPORT_SAFE_BROWSING_WARNINGS); IDS_MANAGEMENT_EXTENSION_REPORT_SAFE_BROWSING_WARNINGS);
source->AddLocalizedString(kManagementExtensionReportPerfCrash, source->AddLocalizedString(kManagementExtensionReportPerfCrash,
IDS_MANAGEMENT_EXTENSION_REPORT_PERF_CRASH); IDS_MANAGEMENT_EXTENSION_REPORT_PERF_CRASH);
source->AddLocalizedString(
kManagementExtensionReportWebsiteUsageStatistics,
IDS_MANAGEMENT_EXTENSION_REPORT_WEBSITE_USAGE_STATISTICS);
#endif // BUILDFLAG(ENABLE_EXTENSIONS) #endif // BUILDFLAG(ENABLE_EXTENSIONS)
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_UI_WEBUI_MANAGEMENT_UI_HANDLER_H_ #ifndef CHROME_BROWSER_UI_WEBUI_MANAGEMENT_UI_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_MANAGEMENT_UI_HANDLER_H_ #define CHROME_BROWSER_UI_WEBUI_MANAGEMENT_UI_HANDLER_H_
#include <string>
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
...@@ -21,21 +23,48 @@ extern const char kManagementReportNetworkInterfaces[]; ...@@ -21,21 +23,48 @@ extern const char kManagementReportNetworkInterfaces[];
extern const char kManagementReportUsers[]; extern const char kManagementReportUsers[];
#if BUILDFLAG(ENABLE_EXTENSIONS) #if BUILDFLAG(ENABLE_EXTENSIONS)
extern const char kCloudReportingExtensionId[];
extern const char kOnPremReportingExtensionStableId[];
extern const char kOnPremReportingExtensionBetaId[];
extern const char kManagementExtensionReportMachineName[]; extern const char kManagementExtensionReportMachineName[];
extern const char kManagementExtensionReportMachineNameAddress[]; extern const char kManagementExtensionReportMachineNameAddress[];
extern const char kManagementExtensionReportUsername[]; extern const char kManagementExtensionReportUsername[];
extern const char kManagementExtensionReportVersion[]; extern const char kManagementExtensionReportVersion[];
extern const char kManagementExtensionReportPolicies[]; extern const char kManagementExtensionReportPolicies[];
extern const char kManagementExtensionReportExtensionsPlugin[]; extern const char kManagementExtensionReportExtensionsPlugin[];
extern const char kManagementExtensionReportExtensionsAndPolicies[];
extern const char kManagementExtensionReportSafeBrowsingWarnings[]; extern const char kManagementExtensionReportSafeBrowsingWarnings[];
extern const char kManagementExtensionReportPerfCrash[]; extern const char kManagementExtensionReportPerfCrash[];
extern const char kManagementExtensionReportWebsiteUsageStatistics[];
extern const char kPolicyKeyReportMachineIdData[];
extern const char kPolicyKeyReportUserIdData[];
extern const char kPolicyKeyReportVersionData[];
extern const char kPolicyKeyReportPolicyData[];
extern const char kPolicyKeyReportExtensionsData[];
extern const char kPolicyKeyReportSafeBrowsingData[];
extern const char kPolicyKeyReportSystemTelemetryData[];
extern const char kPolicyKeyReportUserBrowsingData[];
extern const char kReportingTypeDevice[];
extern const char kReportingTypeExtensions[];
extern const char kReportingTypeSecurity[];
extern const char kReportingTypeUser[];
#endif // BUILDFLAG(ENABLE_EXTENSIONS) #endif // BUILDFLAG(ENABLE_EXTENSIONS)
namespace base { namespace base {
class ListValue; class ListValue;
} // namespace base } // namespace base
namespace extensions {
class Extension;
} // namespace extensions
namespace policy {
class PolicyService;
} // namespace policy
// The JavaScript message handler for the chrome://management page. // The JavaScript message handler for the chrome://management page.
class ManagementUIHandler : public content::WebUIMessageHandler { class ManagementUIHandler : public content::WebUIMessageHandler {
public: public:
...@@ -45,11 +74,16 @@ class ManagementUIHandler : public content::WebUIMessageHandler { ...@@ -45,11 +74,16 @@ class ManagementUIHandler : public content::WebUIMessageHandler {
// content::WebUIMessageHandler implementation. // content::WebUIMessageHandler implementation.
void RegisterMessages() override; void RegisterMessages() override;
private:
#if BUILDFLAG(ENABLE_EXTENSIONS) #if BUILDFLAG(ENABLE_EXTENSIONS)
protected:
void AddExtensionReportingInfo(base::Value* report_sources); void AddExtensionReportingInfo(base::Value* report_sources);
virtual const policy::PolicyService* GetPolicyService() const;
virtual const extensions::Extension* GetEnabledExtension(
const std::string& extensionId) const;
#endif // BUILDFLAG(ENABLE_EXTENSIONS) #endif // BUILDFLAG(ENABLE_EXTENSIONS)
private:
base::string16 GetEnterpriseManagementStatusString(); base::string16 GetEnterpriseManagementStatusString();
void HandleGetDeviceManagementStatus(const base::ListValue* args); void HandleGetDeviceManagementStatus(const base::ListValue* args);
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include <set>
#include <string>
#include "chrome/browser/ui/webui/management_ui_handler.h"
#include "components/policy/core/common/mock_policy_service.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/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
using testing::_;
using testing::ReturnRef;
class TestManagementUIHandler : public ManagementUIHandler {
public:
TestManagementUIHandler() = default;
explicit TestManagementUIHandler(policy::PolicyService* policy_service)
: policy_service_(policy_service) {}
~TestManagementUIHandler() override = default;
void EnableCloudReportingExtension(bool enable) {
cloud_reporting_extension_exists_ = enable;
}
base::Value GetExtensionReportingInfo() {
base::Value report_sources(base::Value::Type::LIST);
AddExtensionReportingInfo(&report_sources);
return report_sources;
}
const policy::PolicyService* GetPolicyService() const override {
return policy_service_;
}
const extensions::Extension* GetEnabledExtension(
const std::string& extensionId) const override {
if (cloud_reporting_extension_exists_)
return extensions::ExtensionBuilder("dummy").SetID("id").Build().get();
return nullptr;
}
private:
bool cloud_reporting_extension_exists_ = false;
policy::PolicyService* policy_service_ = nullptr;
};
class ManagementUIHandlerTests : public testing::Test {
public:
ManagementUIHandlerTests() : handler_(&policy_service_) {
ON_CALL(policy_service_, GetPolicies(_))
.WillByDefault(ReturnRef(empty_policy_map_));
}
void EnablePolicy(const char* policy_key, policy::PolicyMap& policies) {
policies.Set(policy_key, policy::POLICY_LEVEL_MANDATORY,
policy::POLICY_SCOPE_MACHINE, policy::POLICY_SOURCE_CLOUD,
std::make_unique<base::Value>(true), nullptr);
}
protected:
TestManagementUIHandler handler_;
policy::MockPolicyService policy_service_;
policy::PolicyMap empty_policy_map_;
};
TEST_F(ManagementUIHandlerTests, ExtensionReportingInfoNoPolicySetNoMessage) {
handler_.EnableCloudReportingExtension(false);
auto reporting_info = handler_.GetExtensionReportingInfo();
EXPECT_EQ(reporting_info.GetList().size(), 0u);
}
TEST_F(ManagementUIHandlerTests,
ExtensionReportingInfoCloudExtensionAddsDefaultPolicies) {
handler_.EnableCloudReportingExtension(true);
std::set<std::string> expected_messages = {
kManagementExtensionReportMachineName, kManagementExtensionReportUsername,
kManagementExtensionReportVersion,
kManagementExtensionReportExtensionsAndPolicies,
kManagementExtensionReportSafeBrowsingWarnings};
auto reporting_info = handler_.GetExtensionReportingInfo();
const auto& reporting_info_list = reporting_info.GetList();
for (const base::Value& info : reporting_info_list) {
const std::string* messageId = info.FindStringKey("messageId");
EXPECT_TRUE(expected_messages.find(*messageId) != expected_messages.end());
}
EXPECT_EQ(reporting_info.GetList().size(), expected_messages.size());
}
TEST_F(ManagementUIHandlerTests, ExtensionReportingInfoPoliciesMerge) {
policy::PolicyMap on_prem_reporting_extension_beta_policies;
policy::PolicyMap on_prem_reporting_extension_stable_policies;
EnablePolicy(kPolicyKeyReportUserIdData,
on_prem_reporting_extension_beta_policies);
EnablePolicy(kManagementExtensionReportVersion,
on_prem_reporting_extension_beta_policies);
EnablePolicy(kPolicyKeyReportUserIdData,
on_prem_reporting_extension_beta_policies);
EnablePolicy(kPolicyKeyReportPolicyData,
on_prem_reporting_extension_stable_policies);
EnablePolicy(kPolicyKeyReportMachineIdData,
on_prem_reporting_extension_stable_policies);
EnablePolicy(kPolicyKeyReportSafeBrowsingData,
on_prem_reporting_extension_stable_policies);
EnablePolicy(kPolicyKeyReportSystemTelemetryData,
on_prem_reporting_extension_stable_policies);
EnablePolicy(kPolicyKeyReportUserBrowsingData,
on_prem_reporting_extension_stable_policies);
const policy::PolicyNamespace
on_prem_reporting_extension_stable_policy_namespace =
policy::PolicyNamespace(policy::POLICY_DOMAIN_EXTENSIONS,
kOnPremReportingExtensionStableId);
const policy::PolicyNamespace
on_prem_reporting_extension_beta_policy_namespace =
policy::PolicyNamespace(policy::POLICY_DOMAIN_EXTENSIONS,
kOnPremReportingExtensionBetaId);
EXPECT_CALL(policy_service_,
GetPolicies(on_prem_reporting_extension_stable_policy_namespace))
.WillOnce(ReturnRef(on_prem_reporting_extension_stable_policies));
EXPECT_CALL(policy_service_,
GetPolicies(on_prem_reporting_extension_beta_policy_namespace))
.WillOnce(ReturnRef(on_prem_reporting_extension_beta_policies));
handler_.EnableCloudReportingExtension(true);
std::set<std::string> expected_messages = {
kManagementExtensionReportMachineNameAddress,
kManagementExtensionReportUsername,
kManagementExtensionReportVersion,
kManagementExtensionReportExtensionsAndPolicies,
kManagementExtensionReportSafeBrowsingWarnings,
kManagementExtensionReportPerfCrash};
auto reporting_info = handler_.GetExtensionReportingInfo();
const auto& reporting_info_list = reporting_info.GetList();
for (const base::Value& info : reporting_info_list) {
const std::string* message_id = info.FindStringKey("messageId");
ASSERT_TRUE(message_id != nullptr);
EXPECT_TRUE(expected_messages.find(*message_id) != expected_messages.end());
}
EXPECT_EQ(reporting_info.GetList().size(), expected_messages.size());
}
...@@ -3413,6 +3413,7 @@ test("unit_tests") { ...@@ -3413,6 +3413,7 @@ test("unit_tests") {
"../browser/ui/webui/downloads/mock_downloads_page.h", "../browser/ui/webui/downloads/mock_downloads_page.h",
"../browser/ui/webui/help/version_updater_chromeos_unittest.cc", "../browser/ui/webui/help/version_updater_chromeos_unittest.cc",
"../browser/ui/webui/managed_ui_handler_unittest.cc", "../browser/ui/webui/managed_ui_handler_unittest.cc",
"../browser/ui/webui/management_ui_handler_unittest.cc",
"../browser/ui/webui/settings/downloads_handler_unittest.cc", "../browser/ui/webui/settings/downloads_handler_unittest.cc",
"../browser/ui/webui/settings/metrics_reporting_handler_unittest.cc", "../browser/ui/webui/settings/metrics_reporting_handler_unittest.cc",
"../browser/ui/webui/settings/on_startup_handler_unittest.cc", "../browser/ui/webui/settings/on_startup_handler_unittest.cc",
......
...@@ -44,9 +44,12 @@ ...@@ -44,9 +44,12 @@
<message name="IDS_MANAGEMENT_DEVICE_REPORTING" desc="Title of the types of device reporting section of the page"> <message name="IDS_MANAGEMENT_DEVICE_REPORTING" desc="Title of the types of device reporting section of the page">
Reporting Reporting
</message> </message>
<message name="IDS_MANAGEMENT_BROWSER_REPORTING" desc="Title of the types of browser reporting section of the page" translateable="false"> <message name="IDS_MANAGEMENT_BROWSER_REPORTING" desc="Title of the types of browser reporting section of the page">
Browser reporting Browser reporting
</message> </message>
<message name="IDS_MANAGEMENT_BROWSER_REPORTING_EXPLANATION" desc="Message explaining browser reporting">
Your browser has been configured to report
</message>
<message name="IDS_MANAGEMENT_DEVICE_CONFIGURATION" desc="Message telling users that their administrator has set some specific policies on their device"> <message name="IDS_MANAGEMENT_DEVICE_CONFIGURATION" desc="Message telling users that their administrator has set some specific policies on their device">
Your device has been configured to: Your device has been configured to:
</message> </message>
...@@ -82,42 +85,42 @@ ...@@ -82,42 +85,42 @@
<message name="IDS_MANAGEMENT_LOCAL_TRUST_ROOTS" desc="Title of the types of local trust roots section of the page"> <message name="IDS_MANAGEMENT_LOCAL_TRUST_ROOTS" desc="Title of the types of local trust roots section of the page">
Custom root certificates Custom root certificates
</message> </message>
<message name="IDS_MANAGEMENT_TRUST_ROOTS_NOT_CONFIGURED" desc="Message describing that the administrators have not installed certificates" translateable="false"> <message name="IDS_MANAGEMENT_TRUST_ROOTS_NOT_CONFIGURED" desc="Message describing that the administrators have not installed certificates">
The contents of websites that you visit is not seen by your administrators The contents of websites that you visit is not seen by your administrators
</message> </message>
<message name="IDS_MANAGEMENT_EXTENSION_REPORT_MACHINE_NAME" desc="Message explaining that an extension currently reports the user's machine name" translateable="false"> <message name="IDS_MANAGEMENT_EXTENSION_REPORT_MACHINE_NAME" desc="Message explaining that an extension currently reports the user's machine name">
Report your machine's name Your machine's name
</message> </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"> <message name="IDS_MANAGEMENT_EXTENSION_REPORT_MACHINE_NAME_ADDRESS" desc="Message explaining that an extension currently reports the user's machine name and address">
Report your machine's name and network address Your machine's name and network address
</message> </message>
<message name="IDS_MANAGEMENT_EXTENSION_REPORT_USERNAME" desc="Message explaining that an extension currently reports the user's username" translateable="false"> <message name="IDS_MANAGEMENT_EXTENSION_REPORT_USERNAME" desc="Message explaining that an extension currently reports the user's username">
Report you OS and browser usernames Your OS and browser usernames
</message> </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"> <message name="IDS_MANAGEMENT_EXTENSION_REPORT_VERSION" desc="Message explaining that an extension currently reports the user's browser and machine version">
Report software version information about your browser and machine Software version information about your browser and machine
</message> </message>
<message name="IDS_MANAGEMENT_EXTENSION_REPORT_POLICIES" desc="Message explaining that an extension currently reports the user's enterprise policies" translateable="false"> <message name="IDS_MANAGEMENT_EXTENSION_REPORT_POLICIES" desc="Message explaining that an extension currently reports the user's enterprise policies">
Report information about applied enterprise policies Information about applied enterprise policies
</message> </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"> <message name="IDS_MANAGEMENT_EXTENSION_REPORT_EXTENSIONS_PLUGINS" desc="Message explaining that an extension currently reports the user's exensions and plugins">
Report installed extensions and plugins Installed extensions and plugins
</message> </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"> <message name="IDS_MANAGEMENT_EXTENSION_REPORT_EXTENSIONS_AND_POLICIES" desc="Message explaining that an extension currently reports the user's enterprise policies and extensions">
Report Safe Browsing warnings Information about applied enterprise policies, installed extensions and plugins
</message> </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"> <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">
Report performance data and crash reports Safe browsing warnings
</message> </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"> <message name="IDS_MANAGEMENT_EXTENSION_REPORT_PERF_CRASH" desc="Message explaining that an extension currently reports the user's performance data and crash report">
Report how much time you spend on each website Performance data and crash reports
</message> </message>
<if expr="chromeos"> <if expr="chromeos">
<message name="IDS_MANAGEMENT_TRUST_ROOTS_CONFIGURED" desc="Message describing that the administrators have installed their own certificates"> <message name="IDS_MANAGEMENT_TRUST_ROOTS_CONFIGURED" desc="Message describing that the administrators have installed their own certificates">
Your administrator has configured custom root certificates, which may allow the administrator to see the contents of websites that you visit. Your administrator has configured custom root certificates, which may allow the administrator to see the contents of websites that you visit.
</message> </message>
</if> </if>
<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"> <message name="IDS_MANAGEMENT_DESKTOP_MONITORING_NOTICE" desc="Message explaining that the administrators have ways to monitor users outside of chrome's control">
Administrators may have other ways of monitoring users, outside of Chrome. Administrators may have other ways of monitoring users, outside of Chrome.
</message> </message>
</grit-part> </grit-part>
...@@ -41,6 +41,7 @@ blurry at 20 px). Please use 20 px icons when available. ...@@ -41,6 +41,7 @@ blurry at 20 px). Please use 20 px icons when available.
<g id="chevron-right"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></g> <g id="chevron-right"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></g>
<g id="clear"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></g> <g id="clear"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></g>
<g id="close"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></g> <g id="close"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></g>
<g id="computer"><path d="M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z"></path></g>
<g id="delete"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"></path></g> <g id="delete"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"></path></g>
<g id="domain"><path d="M12 7V3H2v18h20V7H12zM6 19H4v-2h2v2zm0-4H4v-2h2v2zm0-4H4V9h2v2zm0-4H4V5h2v2zm4 12H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V9h2v2zm0-4H8V5h2v2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10zm-2-8h-2v2h2v-2zm0 4h-2v2h2v-2z"></path></g> <g id="domain"><path d="M12 7V3H2v18h20V7H12zM6 19H4v-2h2v2zm0-4H4v-2h2v2zm0-4H4V9h2v2zm0-4H4V5h2v2zm4 12H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V9h2v2zm0-4H8V5h2v2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10zm-2-8h-2v2h2v-2zm0 4h-2v2h2v-2z"></path></g>
<g id="error"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"></path></g> <g id="error"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"></path></g>
......
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