Commit 8c2e0729 authored by Olya Kalitova's avatar Olya Kalitova Committed by Commit Bot

Add Plugin VM data collection info to chrome://management

Adds information about Plugin VM data collection to transparency panel
(chrome://management). This info is visible when Plugin VM data
collection is enabled on user's device.

Test: manually using YAPS
Bug: b/150908305
Change-Id: I99e7b66cc3a765166d216ea6f24cfb32f16eb6d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2279119Reviewed-by: default avatarDenis Kuznetsov [CET] <antrim@chromium.org>
Reviewed-by: default avatarGreg Levin <glevin@chromium.org>
Commit-Queue: Olya Kalitova <okalitova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785353}
parent 549f91e7
......@@ -106,6 +106,12 @@ export class ManagementBrowserProxy {
* items to display in device reporting section.
*/
getDeviceReportingInfo() {}
/**
* @return {!Promise<boolean>} Boolean describing Plugin VM data collection
* enabled or not.
*/
getPluginVmDataCollectionStatus() {}
// </if>
/** @return {!Promise<!ManagedDataResponse>} */
......@@ -138,6 +144,11 @@ export class ManagementBrowserProxyImpl {
getDeviceReportingInfo() {
return sendWithPromise('getDeviceReportingInfo');
}
/** @override */
getPluginVmDataCollectionStatus() {
return sendWithPromise('getPluginVmDataCollectionStatus');
}
// </if>
/** @override */
......
......@@ -237,6 +237,10 @@
</div>
</template>
</div>
<div class="subtitle"
hidden="[[!pluginVmDataCollectionEnabled_]]">
$i18nRaw{pluginVmDataCollection}
</div>
</section>
</template>
</if>
......
......@@ -72,6 +72,9 @@ Polymer({
/** @private */
managementOverview_: String,
/** @private */
pluginVmDataCollectionEnabled_: Boolean,
// </if>
/** @private */
......@@ -107,6 +110,10 @@ Polymer({
'browser-reporting-info-updated',
reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo));
this.addWebUIListener(
'plugin-vm-data-collection-updated',
enabled => this.pluginVmDataCollectionEnabled_ = enabled);
this.addWebUIListener('managed_data_changed', () => {
this.updateManagedFields_();
});
......@@ -118,6 +125,7 @@ Polymer({
this.getExtensions_();
// <if expr="chromeos">
this.getDeviceReportingInfo_();
this.getPluginVmDataCollectionStatus_();
this.getLocalTrustRootsInfo_();
// </if>
},
......@@ -196,6 +204,14 @@ Polymer({
});
},
/** @private */
getPluginVmDataCollectionStatus_() {
this.browserProxy_.getPluginVmDataCollectionStatus().then(
pluginVmDataCollectionEnabled => {
this.pluginVmDataCollectionEnabled_ = pluginVmDataCollectionEnabled;
});
},
/**
* @return {boolean} True of there are device reporting info to show.
* @private
......
......@@ -125,6 +125,10 @@ content::WebUIDataSource* CreateManagementUIHtmlSource(Profile* profile) {
chrome::kLearnMoreEnterpriseURL);
source->AddString("managementAccountLearnMoreUrl",
chrome::kManagedUiLearnMoreUrl);
source->AddString("pluginVmDataCollection",
l10n_util::GetStringFUTF16(
IDS_MANAGEMENT_REPORT_PLUGIN_VM,
l10n_util::GetStringUTF16(IDS_PLUGIN_VM_APP_NAME)));
#endif // defined(OS_CHROMEOS)
source->UseStringsJs();
......
......@@ -41,6 +41,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/crostini/crostini_features.h"
#include "chrome/browser/chromeos/crostini/crostini_pref_names.h"
#include "chrome/browser/chromeos/plugin_vm/plugin_vm_pref_names.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
#include "chrome/browser/chromeos/policy/policy_cert_service.h"
......@@ -384,6 +385,11 @@ void ManagementUIHandler::RegisterMessages() {
"getDeviceReportingInfo",
base::BindRepeating(&ManagementUIHandler::HandleGetDeviceReportingInfo,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"getPluginVmDataCollectionStatus",
base::BindRepeating(
&ManagementUIHandler::HandleGetPluginVmDataCollectionStatus,
base::Unretained(this)));
#endif // defined(OS_CHROMEOS)
web_ui()->RegisterMessageCallback(
"getThreatProtectionInfo",
......@@ -941,6 +947,18 @@ void ManagementUIHandler::HandleGetDeviceReportingInfo(
ResolveJavascriptCallback(args->GetList()[0] /* callback_id */,
report_sources);
}
void ManagementUIHandler::HandleGetPluginVmDataCollectionStatus(
const base::ListValue* args) {
CHECK_EQ(1U, args->GetSize());
base::Value plugin_vm_data_collection_enabled(
Profile::FromWebUI(web_ui())->GetPrefs()->GetBoolean(
plugin_vm::prefs::kPluginVmDataCollectionAllowed));
AllowJavascript();
ResolveJavascriptCallback(args->GetList()[0] /* callback_id */,
plugin_vm_data_collection_enabled);
}
#endif // defined(OS_CHROMEOS)
void ManagementUIHandler::HandleGetContextualManagedData(
......@@ -974,6 +992,15 @@ void ManagementUIHandler::NotifyBrowserReportingInfoUpdated() {
FireWebUIListener("browser-reporting-info-updated", report_sources);
}
#if defined(OS_CHROMEOS)
void ManagementUIHandler::NotifyPluginVmDataCollectionUpdated() {
FireWebUIListener(
"plugin-vm-data-collection-updated",
base::Value(Profile::FromWebUI(web_ui())->GetPrefs()->GetBoolean(
plugin_vm::prefs::kPluginVmDataCollectionAllowed)));
}
#endif // defined(OS_CHROMEOS)
void ManagementUIHandler::NotifyThreatProtectionInfoUpdated() {
FireWebUIListener("threat-protection-info-updated",
GetThreatProtectionInfo(Profile::FromWebUI(web_ui())));
......@@ -1044,6 +1071,14 @@ void ManagementUIHandler::AddObservers() {
prefs::kSupervisedUserId,
base::BindRepeating(&ManagementUIHandler::UpdateManagedState,
base::Unretained(this)));
#if defined(OS_CHROMEOS)
pref_registrar_.Add(
plugin_vm::prefs::kPluginVmDataCollectionAllowed,
base::BindRepeating(
&ManagementUIHandler::NotifyPluginVmDataCollectionUpdated,
base::Unretained(this)));
#endif // defined(OS_CHROMEOS)
}
void ManagementUIHandler::RemoveObservers() {
......
......@@ -152,14 +152,11 @@ class ManagementUIHandler : public content::WebUIMessageHandler,
#if defined(OS_CHROMEOS)
void HandleGetDeviceReportingInfo(const base::ListValue* args);
#endif // defined(OS_CHROMEOS)
void HandleGetExtensions(const base::ListValue* args);
#if defined(OS_CHROMEOS)
void HandleGetPluginVmDataCollectionStatus(const base::ListValue* args);
void HandleGetLocalTrustRootsInfo(const base::ListValue* args);
#endif // defined(OS_CHROMEOS)
void HandleGetExtensions(const base::ListValue* args);
void HandleGetContextualManagedData(const base::ListValue* args);
void HandleGetThreatProtectionInfo(const base::ListValue* args);
void HandleInitBrowserReportingInfo(const base::ListValue* args);
......@@ -170,6 +167,9 @@ class ManagementUIHandler : public content::WebUIMessageHandler,
void OnFetchComplete(const GURL& url, const SkBitmap* bitmap) override;
void NotifyBrowserReportingInfoUpdated();
#if defined(OS_CHROMEOS)
void NotifyPluginVmDataCollectionUpdated();
#endif // defined(OS_CHROMEOS)
void NotifyThreatProtectionInfoUpdated();
// extensions::ExtensionRegistryObserver implementation.
......
......@@ -125,6 +125,9 @@
<message name="IDS_MANAGEMENT_REPORT_PROXY_SERVER" desc="Message stating that administrators can see user's traffic when connected to a proxy server.">
Websites you visit and the contents of not secure pages
</message>
<message name="IDS_MANAGEMENT_REPORT_PLUGIN_VM" desc="Message telling users that Plugin VM can collect data.">
<ph name="APP_NAME">$1<ex>Plugin VM</ex></ph> collects diagnostics data to improve the product experience. See <ph name="BEGIN_LINK">&lt;a target="_blank" href="https://www.parallels.com/pcep"&gt;</ph>https://www.parallels.com/pcep<ph name="END_LINK">&lt;/a&gt;</ph> for more information.
</message>
</if>
<!-- Strings related to extension reporting section of the management page -->
......
516d0e7dac1ff3fdf9bb21437fa124fb807cb147
\ No newline at end of file
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