Commit a398dcde authored by dbeam's avatar dbeam Committed by Commit bot

MD Settings: hide browsing history-related rows for supervised users

R=dpapad@chromium.org
BUG=696910
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2855123004
Cr-Commit-Position: refs/heads/master@{#469555}
parent 799c3a19
......@@ -111,17 +111,23 @@
menu-options="[[clearFromOptions_]]">
</settings-dropdown-menu>
</div>
<!-- Note: whether these checkboxes are checked are ignored if deleting
history is disabled (i.e. supervised users, policy), so it's OK to
have a hidden checkbox that's also checked (as the C++ accounts for
whether a user is allowed to delete history independently). -->
<settings-checkbox id="browsingCheckbox"
pref="{{prefs.browser.clear_data.browsing_history}}"
label="$i18n{clearBrowsingHistory}"
sub-label="[[counters_.browsing_history]]"
disabled="[[clearingInProgress_]]">
disabled="[[clearingInProgress_]]"
hidden="[[isSupervised_]]">
</settings-checkbox>
<settings-checkbox id="downloadCheckbox"
pref="{{prefs.browser.clear_data.download_history}}"
label="$i18n{clearDownloadHistory}"
sub-label="[[counters_.download_history]]"
disabled="[[clearingInProgress_]]">
disabled="[[clearingInProgress_]]"
hidden="[[isSupervised_]]">
</settings-checkbox>
<settings-checkbox
pref="{{prefs.browser.clear_data.cache}}"
......
......@@ -55,6 +55,14 @@ Polymer({
value: false,
},
/** @private */
isSupervised_: {
type: Boolean,
value: function() {
return loadTimeData.getBoolean('isSupervised');
},
},
/** @private */
showHistoryDeletionDialog_: {
type: Boolean,
......
......@@ -15,6 +15,7 @@
'dependencies': [
'<(DEPTH)/third_party/polymer/v1_0/components-chromium/iron-resizable-behavior/compiled_resources2.gyp:iron-resizable-behavior-extracted',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:load_time_data',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:web_ui_listener_behavior',
'../device_page/compiled_resources2.gyp:keyboard',
'clear_browsing_data_browser_proxy',
......
......@@ -112,6 +112,8 @@ void AddCommonStrings(content::WebUIDataSource* html_source, Profile* profile) {
#else
profile->IsOffTheRecord());
#endif
html_source->AddBoolean("isSupervised", profile->IsSupervised());
}
void AddA11yStrings(content::WebUIDataSource* html_source) {
......@@ -351,8 +353,6 @@ void AddAppearanceStrings(content::WebUIDataSource* html_source,
};
AddLocalizedStringsBulk(html_source, localized_strings,
arraysize(localized_strings));
html_source->AddBoolean("isSupervised", profile->IsSupervised());
}
#if defined(OS_CHROMEOS)
......
......@@ -229,6 +229,25 @@ cr.define('settings_privacy_page', function() {
'update-counter-text', checkbox.pref.key, 'result');
assertEquals('result', checkbox.subLabel);
});
test('history rows are hidden for supervised users', function() {
assertFalse(loadTimeData.getBoolean('isSupervised'));
assertFalse(element.$.browsingCheckbox.hidden);
assertFalse(element.$.downloadCheckbox.hidden);
element.remove();
testBrowserProxy.reset();
loadTimeData.overrideValues({isSupervised: true});
element = document.createElement('settings-clear-browsing-data-dialog');
document.body.appendChild(element);
Polymer.dom.flush();
return testBrowserProxy.whenCalled('initialize').then(function() {
assertTrue(element.$.browsingCheckbox.hidden);
assertTrue(element.$.downloadCheckbox.hidden);
});
});
});
}
......
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