Commit 30b2ad18 authored by danielng's avatar danielng Committed by Commit Bot

plugin_vm: Adding UI elements for plugin vm camera settings

Adding a toggle to the plugin vm settings page to control whether
the camera should be shared with plugin vm. Currently hidden behind
a feature which is disabled by default.

Bug: 1016193
Change-Id: I793c66ada1287fcaee21088f123281d3f8f76a52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2131675Reviewed-by: default avatarTimothy Loh <timloh@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Daniel Ng <danielng@google.com>
Cr-Commit-Position: refs/heads/master@{#756176}
parent 4eabdd83
...@@ -818,6 +818,9 @@ ...@@ -818,6 +818,9 @@
<message name="IDS_SETTINGS_PLUGIN_VM_CONFIRM_REMOVE_DIALOG_BODY" desc="Message of the confirmation dialog displayed before removal begins."> <message name="IDS_SETTINGS_PLUGIN_VM_CONFIRM_REMOVE_DIALOG_BODY" desc="Message of the confirmation dialog displayed before removal begins.">
Removing Plugin VM will delete your VM. This includes its applications, settings, and data. Are you sure you wish to continue? Removing Plugin VM will delete your VM. This includes its applications, settings, and data. Are you sure you wish to continue?
</message> </message>
<message name="IDS_SETTINGS_PLUGIN_VM_CAMERA_ACCESS_TITLE" desc="The text in the settings page for allowing camera access from Plugin VM.">
Give access to camera
</message>
<!-- Crostini --> <!-- Crostini -->
<message name="IDS_SETTINGS_CROSTINI_TITLE" desc="The title of Crostini section."> <message name="IDS_SETTINGS_CROSTINI_TITLE" desc="The title of Crostini section.">
......
f94e7f724029c18d71fb54cddfdc0b93d9e246e0
\ No newline at end of file
...@@ -23,6 +23,9 @@ const char kPluginVmImage[] = "plugin_vm.image"; ...@@ -23,6 +23,9 @@ const char kPluginVmImage[] = "plugin_vm.image";
const char kPluginVmImageExists[] = "plugin_vm.image_exists"; const char kPluginVmImageExists[] = "plugin_vm.image_exists";
// A boolean preference indicating whether Plugin VM is allowed to use printers. // A boolean preference indicating whether Plugin VM is allowed to use printers.
const char kPluginVmPrintersAllowed[] = "plugin_vm.printers_allowed"; const char kPluginVmPrintersAllowed[] = "plugin_vm.printers_allowed";
// A boolean preference indicating whether the camera should be shared with
// PluginVm.
const char kPluginVmCameraSharing[] = "plugin_vm.camera_sharing";
// Preferences for storing engagement time data, as per // Preferences for storing engagement time data, as per
// GuestOsEngagementMetrics. // GuestOsEngagementMetrics.
const char kEngagementPrefsPrefix[] = "plugin_vm.metrics"; const char kEngagementPrefsPrefix[] = "plugin_vm.metrics";
...@@ -33,6 +36,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { ...@@ -33,6 +36,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) {
// TODO(crbug.com/1066760): For convenience this currently defaults to true, // TODO(crbug.com/1066760): For convenience this currently defaults to true,
// but we'll need to revisit before launch. // but we'll need to revisit before launch.
registry->RegisterBooleanPref(kPluginVmPrintersAllowed, true); registry->RegisterBooleanPref(kPluginVmPrintersAllowed, true);
registry->RegisterBooleanPref(kPluginVmCameraSharing, false);
guest_os::prefs::RegisterEngagementProfilePrefs(registry, guest_os::prefs::RegisterEngagementProfilePrefs(registry,
kEngagementPrefsPrefix); kEngagementPrefsPrefix);
......
...@@ -13,6 +13,7 @@ namespace prefs { ...@@ -13,6 +13,7 @@ namespace prefs {
extern const char kPluginVmImage[]; extern const char kPluginVmImage[];
extern const char kPluginVmImageExists[]; extern const char kPluginVmImageExists[];
extern const char kPluginVmPrintersAllowed[]; extern const char kPluginVmPrintersAllowed[];
extern const char kPluginVmCameraSharing[];
extern const char kEngagementPrefsPrefix[]; extern const char kEngagementPrefsPrefix[];
void RegisterProfilePrefs(PrefRegistrySimple* registry); void RegisterProfilePrefs(PrefRegistrySimple* registry);
......
...@@ -473,6 +473,8 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() { ...@@ -473,6 +473,8 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
settings_api::PrefType::PREF_TYPE_BOOLEAN; settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[plugin_vm::prefs::kPluginVmPrintersAllowed] = (*s_whitelist)[plugin_vm::prefs::kPluginVmPrintersAllowed] =
settings_api::PrefType::PREF_TYPE_BOOLEAN; settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[plugin_vm::prefs::kPluginVmCameraSharing] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
// Android Apps. // Android Apps.
(*s_whitelist)[arc::prefs::kArcEnabled] = (*s_whitelist)[arc::prefs::kArcEnabled] =
......
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
label="$i18n{pluginVmPrinterAccess}" label="$i18n{pluginVmPrinterAccess}"
pref="{{prefs.plugin_vm.printers_allowed}}"> pref="{{prefs.plugin_vm.printers_allowed}}">
</settings-toggle-button> </settings-toggle-button>
<template is="dom-if" if="[[showPluginVmCamera_]]">
<settings-toggle-button label="$i18n{pluginVmCameraAccessTitle}"
pref="{{prefs.plugin_vm.camera_sharing}}">
</settings-toggle-button>
</template>
<div id="plugin-vm-remove" class="settings-box"> <div id="plugin-vm-remove" class="settings-box">
<div id="pluginVmRemoveLabel" class="start">$i18n{pluginVmRemove}</div> <div id="pluginVmRemoveLabel" class="start">$i18n{pluginVmRemove}</div>
<cr-button on-click="onRemoveClick_" id="pluginVmRemoveButton" <cr-button on-click="onRemoveClick_" id="pluginVmRemoveButton"
......
...@@ -24,6 +24,17 @@ Polymer({ ...@@ -24,6 +24,17 @@ Polymer({
type: Boolean, type: Boolean,
value: false, value: false,
}, },
/**
* Whether the toggle to share the camera with PluginVm should be shown.
* @private {boolean}
*/
showPluginVmCamera_: {
type: Boolean,
value() {
return loadTimeData.getBoolean('showPluginVmCamera');
},
},
}, },
observers: [ observers: [
......
...@@ -796,8 +796,12 @@ void AddPluginVmStrings(content::WebUIDataSource* html_source, ...@@ -796,8 +796,12 @@ void AddPluginVmStrings(content::WebUIDataSource* html_source,
{"pluginVmRemoveButton", IDS_SETTINGS_PLUGIN_VM_REMOVE_BUTTON}, {"pluginVmRemoveButton", IDS_SETTINGS_PLUGIN_VM_REMOVE_BUTTON},
{"pluginVmRemoveConfirmationDialogMessage", {"pluginVmRemoveConfirmationDialogMessage",
IDS_SETTINGS_PLUGIN_VM_CONFIRM_REMOVE_DIALOG_BODY}, IDS_SETTINGS_PLUGIN_VM_CONFIRM_REMOVE_DIALOG_BODY},
{"pluginVmCameraAccessTitle", IDS_SETTINGS_PLUGIN_VM_CAMERA_ACCESS_TITLE},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings); AddLocalizedStringsBulk(html_source, kLocalizedStrings);
html_source->AddBoolean("showPluginVmCamera",
base::FeatureList::IsEnabled(
chromeos::features::kPluginVmShowCameraSetting));
} }
void AddAndroidAppStrings(content::WebUIDataSource* html_source) { void AddAndroidAppStrings(content::WebUIDataSource* html_source) {
......
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