Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6997)

Unified Diff: chrome/browser/resources/chromeos/arc_support/background.js

Issue 2225933002: Suppress ToS and reflect admin policy in ARC++ welcome screen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add OS_CHROMEOS checks Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/arc_support/background.js
diff --git a/chrome/browser/resources/chromeos/arc_support/background.js b/chrome/browser/resources/chromeos/arc_support/background.js
index 65a459c0cf210e94a30358978081050282a6f221..fde8828abdbec457d85098d2ed9237c704ed1dfb 100644
--- a/chrome/browser/resources/chromeos/arc_support/background.js
+++ b/chrome/browser/resources/chromeos/arc_support/background.js
@@ -110,8 +110,11 @@ function initialize(data, deviceId) {
loadTimeData.data = data;
appWindow.contentWindow.i18nTemplate.process(doc, loadTimeData);
var countryCode = data.countryCode.toLowerCase();
- setBackupRestoreMode(data.textBackupRestore, data.backupRestoreEnabled);
- setLocationServiceMode(data.textLocationService, data.locationServiceEnabled);
+ setBackupRestoreMode(data.textBackupRestore, data.backupRestoreEnabled,
+ data.backupRestoreManaged, data.managementText);
+ setLocationServiceMode(data.textLocationService, data.locationServiceEnabled,
+ data.locationServiceManaged, data.managementText);
+ hideTermsIfManaged(data.profileManaged);
var scriptSetCountryCode = 'document.countryCode = \'' + countryCode + '\';';
termsView.addContentScripts([
@@ -172,14 +175,25 @@ function setMetricsMode(text, canEnable, on) {
* @param {string} text String used to display next to checkbox.
* @param {boolean} defaultCheckValue Defines the default value for backup and
* restore checkbox.
+ * @param {boolean} isManaged Defines whether this setting is set by policy.
+ * @param {string} managementText String explaining that the setting is enforced
+ * by the administrator.
*/
-function setBackupRestoreMode(text, defaultCheckValue) {
+function setBackupRestoreMode(text, defaultCheckValue, isManaged,
+ managementText) {
var doc = appWindow.contentWindow.document;
doc.getElementById('enable-backup-restore').checked = defaultCheckValue;
+ doc.getElementById('enable-backup-restore').disabled = isManaged;
doc.getElementById('text-backup-restore').innerHTML = text;
+ doc.getElementById('text-backup-restore').disabled = isManaged;
doc.getElementById('learn-more-link-backup-restore').addEventListener('click',
onLearnMore);
+
+ if (isManaged) {
+ doc.getElementById('backup-management-indicator').style.display = 'block';
+ doc.getElementById('backup-management-indicator').title = managementText;
+ }
}
/**
@@ -187,14 +201,37 @@ function setBackupRestoreMode(text, defaultCheckValue) {
* @param {string} text String used to display next to checkbox.
* @param {boolean} defaultCheckValue Defines the default value for location
* service opt in.
+ * @param {boolean} isManaged Defines whether this setting is set by policy.
+ * @param {string} managementText String explaining that the setting is enforced
+ * by the administrator.
*/
-function setLocationServiceMode(text, defaultCheckValue) {
+function setLocationServiceMode(text, defaultCheckValue, isManaged,
+ managementText) {
var doc = appWindow.contentWindow.document;
doc.getElementById('enable-location-service').checked = defaultCheckValue;
+ doc.getElementById('enable-location-service').disabled = isManaged;
doc.getElementById('text-location-service').innerHTML = text;
+ doc.getElementById('text-location-service').disabled = isManaged;
doc.getElementById('learn-more-link-location-service').
addEventListener('click', onLearnMore);
+ if (isManaged) {
+ doc.getElementById('location-management-indicator').style.display = 'block';
+ doc.getElementById('location-management-indicator').title = managementText;
+ }
+}
+
+/**
+ * Hides Terms of Service if the account is managed, because the admin already
+ * agreed to the terms.
+ * @param {boolean} profileManaged Whether the account is managed on Chrome OS.
+ */
+function hideTermsIfManaged(profileManaged) {
+ var doc = appWindow.contentWindow.document;
+ if (profileManaged) {
+ doc.getElementById('terms-title').style.display = 'none';
+ doc.getElementById('terms-container').style.display = 'none';
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698