Commit 041f0d33 authored by Toby Huang's avatar Toby Huang Committed by Commit Bot

Show kite icon and parent tooltip in Site Settings for child users

Site Settings page currently shows the enterprise "office" icon
instead of the "kite" icon for supervised users. This CL fixes this
and ensures that the kite icon and "This setting is managed by a
parent." tooltip is shown in Site Settings when a supervised user
is logged in.

Bug: 1005547
Change-Id: I91d81337b3f1b5cd070163ecc032a1695592dc0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838652
Commit-Queue: Toby Huang <tobyhuang@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705205}
parent 50cf2ba5
...@@ -177,10 +177,22 @@ Polymer({ ...@@ -177,10 +177,22 @@ Polymer({
if (update.source !== undefined && if (update.source !== undefined &&
update.source != ContentSettingProvider.PREFERENCE) { update.source != ContentSettingProvider.PREFERENCE) {
basePref.enforcement = chrome.settingsPrivate.Enforcement.ENFORCED; basePref.enforcement = chrome.settingsPrivate.Enforcement.ENFORCED;
basePref.controlledBy = switch (update.source) {
update.source == ContentSettingProvider.EXTENSION ? case ContentSettingProvider.POLICY:
chrome.settingsPrivate.ControlledBy.EXTENSION : basePref.controlledBy =
chrome.settingsPrivate.ControlledBy.USER_POLICY; chrome.settingsPrivate.ControlledBy.DEVICE_POLICY;
break;
case ContentSettingProvider.SUPERVISED_USER:
basePref.controlledBy = chrome.settingsPrivate.ControlledBy.PARENT;
break;
case ContentSettingProvider.EXTENSION:
basePref.controlledBy = chrome.settingsPrivate.ControlledBy.EXTENSION;
break;
default:
basePref.controlledBy =
chrome.settingsPrivate.ControlledBy.USER_POLICY;
break;
}
} }
const prefValue = this.computeIsSettingEnabled(update.setting); const prefValue = this.computeIsSettingEnabled(update.setting);
......
...@@ -14,8 +14,16 @@ ...@@ -14,8 +14,16 @@
* @enum {string} * @enum {string}
*/ */
const ContentSettingProvider = { const ContentSettingProvider = {
POLICY: 'policy',
SUPERVISED_USER: 'supervised_user',
EXTENSION: 'extension', EXTENSION: 'extension',
INSTALLED_WEBAPP_PROVIDER: 'installed_webapp_provider',
NOTIFICATION_ANDROID: 'notification_android',
EPHEMERAL: 'ephemeral',
PREFERENCE: 'preference', PREFERENCE: 'preference',
DEFAULT: 'default',
TESTS: 'tests',
TESTS_OTHER: 'tests_other'
}; };
/** /**
......
...@@ -35,6 +35,28 @@ suite('CrPolicyIndicatorBehavior', function() { ...@@ -35,6 +35,28 @@ suite('CrPolicyIndicatorBehavior', function() {
indicator.indicatorType, indicator.indicatorSourceName)); indicator.indicatorType, indicator.indicatorSourceName));
}); });
test('parent-controlled indicator', function() {
indicator.indicatorType = CrPolicyIndicatorType.PARENT;
assertTrue(indicator.indicatorVisible);
assertEquals('cr20:kite', indicator.indicatorIcon);
assertEquals(
'parent',
indicator.getIndicatorTooltip(
indicator.indicatorType, indicator.indicatorSourceName));
});
test('child-restriction indicator', function() {
indicator.indicatorType = CrPolicyIndicatorType.CHILD_RESTRICTION;
assertTrue(indicator.indicatorVisible);
assertEquals('cr20:kite', indicator.indicatorIcon);
assertEquals(
'Restricted for child',
indicator.getIndicatorTooltip(
indicator.indicatorType, indicator.indicatorSourceName));
});
test('recommended indicator', function() { test('recommended indicator', function() {
indicator.indicatorType = CrPolicyIndicatorType.RECOMMENDED; indicator.indicatorType = CrPolicyIndicatorType.RECOMMENDED;
......
...@@ -40,5 +40,17 @@ suite('CrPolicyIndicator', function() { ...@@ -40,5 +40,17 @@ suite('CrPolicyIndicator', function() {
assertEquals('cr:person', icon.iconClass); assertEquals('cr:person', icon.iconClass);
assertEquals('owner: foo@example.com', icon.tooltipText); assertEquals('owner: foo@example.com', icon.tooltipText);
} }
indicator.indicatorType = CrPolicyIndicatorType.PARENT;
assertFalse(icon.hidden);
assertEquals('cr20:kite', icon.iconClass);
assertEquals('parent', icon.tooltipText);
indicator.indicatorType = CrPolicyIndicatorType.CHILD_RESTRICTION;
assertFalse(icon.hidden);
assertEquals('cr20:kite', icon.iconClass);
assertEquals('Restricted for child', icon.tooltipText);
}); });
}); });
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