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 { ...@@ -106,6 +106,12 @@ export class ManagementBrowserProxy {
* items to display in device reporting section. * items to display in device reporting section.
*/ */
getDeviceReportingInfo() {} getDeviceReportingInfo() {}
/**
* @return {!Promise<boolean>} Boolean describing Plugin VM data collection
* enabled or not.
*/
getPluginVmDataCollectionStatus() {}
// </if> // </if>
/** @return {!Promise<!ManagedDataResponse>} */ /** @return {!Promise<!ManagedDataResponse>} */
...@@ -138,6 +144,11 @@ export class ManagementBrowserProxyImpl { ...@@ -138,6 +144,11 @@ export class ManagementBrowserProxyImpl {
getDeviceReportingInfo() { getDeviceReportingInfo() {
return sendWithPromise('getDeviceReportingInfo'); return sendWithPromise('getDeviceReportingInfo');
} }
/** @override */
getPluginVmDataCollectionStatus() {
return sendWithPromise('getPluginVmDataCollectionStatus');
}
// </if> // </if>
/** @override */ /** @override */
......
...@@ -237,6 +237,10 @@ ...@@ -237,6 +237,10 @@
</div> </div>
</template> </template>
</div> </div>
<div class="subtitle"
hidden="[[!pluginVmDataCollectionEnabled_]]">
$i18nRaw{pluginVmDataCollection}
</div>
</section> </section>
</template> </template>
</if> </if>
......
...@@ -72,6 +72,9 @@ Polymer({ ...@@ -72,6 +72,9 @@ Polymer({
/** @private */ /** @private */
managementOverview_: String, managementOverview_: String,
/** @private */
pluginVmDataCollectionEnabled_: Boolean,
// </if> // </if>
/** @private */ /** @private */
...@@ -107,6 +110,10 @@ Polymer({ ...@@ -107,6 +110,10 @@ Polymer({
'browser-reporting-info-updated', 'browser-reporting-info-updated',
reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo)); reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo));
this.addWebUIListener(
'plugin-vm-data-collection-updated',
enabled => this.pluginVmDataCollectionEnabled_ = enabled);
this.addWebUIListener('managed_data_changed', () => { this.addWebUIListener('managed_data_changed', () => {
this.updateManagedFields_(); this.updateManagedFields_();
}); });
...@@ -118,6 +125,7 @@ Polymer({ ...@@ -118,6 +125,7 @@ Polymer({
this.getExtensions_(); this.getExtensions_();
// <if expr="chromeos"> // <if expr="chromeos">
this.getDeviceReportingInfo_(); this.getDeviceReportingInfo_();
this.getPluginVmDataCollectionStatus_();
this.getLocalTrustRootsInfo_(); this.getLocalTrustRootsInfo_();
// </if> // </if>
}, },
...@@ -196,6 +204,14 @@ Polymer({ ...@@ -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. * @return {boolean} True of there are device reporting info to show.
* @private * @private
......
...@@ -125,6 +125,10 @@ content::WebUIDataSource* CreateManagementUIHtmlSource(Profile* profile) { ...@@ -125,6 +125,10 @@ content::WebUIDataSource* CreateManagementUIHtmlSource(Profile* profile) {
chrome::kLearnMoreEnterpriseURL); chrome::kLearnMoreEnterpriseURL);
source->AddString("managementAccountLearnMoreUrl", source->AddString("managementAccountLearnMoreUrl",
chrome::kManagedUiLearnMoreUrl); 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) #endif // defined(OS_CHROMEOS)
source->UseStringsJs(); source->UseStringsJs();
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/crostini/crostini_features.h" #include "chrome/browser/chromeos/crostini/crostini_features.h"
#include "chrome/browser/chromeos/crostini/crostini_pref_names.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/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
#include "chrome/browser/chromeos/policy/policy_cert_service.h" #include "chrome/browser/chromeos/policy/policy_cert_service.h"
...@@ -384,6 +385,11 @@ void ManagementUIHandler::RegisterMessages() { ...@@ -384,6 +385,11 @@ void ManagementUIHandler::RegisterMessages() {
"getDeviceReportingInfo", "getDeviceReportingInfo",
base::BindRepeating(&ManagementUIHandler::HandleGetDeviceReportingInfo, base::BindRepeating(&ManagementUIHandler::HandleGetDeviceReportingInfo,
base::Unretained(this))); base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"getPluginVmDataCollectionStatus",
base::BindRepeating(
&ManagementUIHandler::HandleGetPluginVmDataCollectionStatus,
base::Unretained(this)));
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
web_ui()->RegisterMessageCallback( web_ui()->RegisterMessageCallback(
"getThreatProtectionInfo", "getThreatProtectionInfo",
...@@ -941,6 +947,18 @@ void ManagementUIHandler::HandleGetDeviceReportingInfo( ...@@ -941,6 +947,18 @@ void ManagementUIHandler::HandleGetDeviceReportingInfo(
ResolveJavascriptCallback(args->GetList()[0] /* callback_id */, ResolveJavascriptCallback(args->GetList()[0] /* callback_id */,
report_sources); 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) #endif // defined(OS_CHROMEOS)
void ManagementUIHandler::HandleGetContextualManagedData( void ManagementUIHandler::HandleGetContextualManagedData(
...@@ -974,6 +992,15 @@ void ManagementUIHandler::NotifyBrowserReportingInfoUpdated() { ...@@ -974,6 +992,15 @@ void ManagementUIHandler::NotifyBrowserReportingInfoUpdated() {
FireWebUIListener("browser-reporting-info-updated", report_sources); 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() { void ManagementUIHandler::NotifyThreatProtectionInfoUpdated() {
FireWebUIListener("threat-protection-info-updated", FireWebUIListener("threat-protection-info-updated",
GetThreatProtectionInfo(Profile::FromWebUI(web_ui()))); GetThreatProtectionInfo(Profile::FromWebUI(web_ui())));
...@@ -1044,6 +1071,14 @@ void ManagementUIHandler::AddObservers() { ...@@ -1044,6 +1071,14 @@ void ManagementUIHandler::AddObservers() {
prefs::kSupervisedUserId, prefs::kSupervisedUserId,
base::BindRepeating(&ManagementUIHandler::UpdateManagedState, base::BindRepeating(&ManagementUIHandler::UpdateManagedState,
base::Unretained(this))); 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() { void ManagementUIHandler::RemoveObservers() {
......
...@@ -152,14 +152,11 @@ class ManagementUIHandler : public content::WebUIMessageHandler, ...@@ -152,14 +152,11 @@ class ManagementUIHandler : public content::WebUIMessageHandler,
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
void HandleGetDeviceReportingInfo(const base::ListValue* args); void HandleGetDeviceReportingInfo(const base::ListValue* args);
#endif // defined(OS_CHROMEOS) void HandleGetPluginVmDataCollectionStatus(const base::ListValue* args);
void HandleGetExtensions(const base::ListValue* args);
#if defined(OS_CHROMEOS)
void HandleGetLocalTrustRootsInfo(const base::ListValue* args); void HandleGetLocalTrustRootsInfo(const base::ListValue* args);
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
void HandleGetExtensions(const base::ListValue* args);
void HandleGetContextualManagedData(const base::ListValue* args); void HandleGetContextualManagedData(const base::ListValue* args);
void HandleGetThreatProtectionInfo(const base::ListValue* args); void HandleGetThreatProtectionInfo(const base::ListValue* args);
void HandleInitBrowserReportingInfo(const base::ListValue* args); void HandleInitBrowserReportingInfo(const base::ListValue* args);
...@@ -170,6 +167,9 @@ class ManagementUIHandler : public content::WebUIMessageHandler, ...@@ -170,6 +167,9 @@ class ManagementUIHandler : public content::WebUIMessageHandler,
void OnFetchComplete(const GURL& url, const SkBitmap* bitmap) override; void OnFetchComplete(const GURL& url, const SkBitmap* bitmap) override;
void NotifyBrowserReportingInfoUpdated(); void NotifyBrowserReportingInfoUpdated();
#if defined(OS_CHROMEOS)
void NotifyPluginVmDataCollectionUpdated();
#endif // defined(OS_CHROMEOS)
void NotifyThreatProtectionInfoUpdated(); void NotifyThreatProtectionInfoUpdated();
// extensions::ExtensionRegistryObserver implementation. // extensions::ExtensionRegistryObserver implementation.
......
...@@ -125,6 +125,9 @@ ...@@ -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."> <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 Websites you visit and the contents of not secure pages
</message> </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> </if>
<!-- Strings related to extension reporting section of the management page --> <!-- 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