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 @@ ...@@ -111,17 +111,23 @@
menu-options="[[clearFromOptions_]]"> menu-options="[[clearFromOptions_]]">
</settings-dropdown-menu> </settings-dropdown-menu>
</div> </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" <settings-checkbox id="browsingCheckbox"
pref="{{prefs.browser.clear_data.browsing_history}}" pref="{{prefs.browser.clear_data.browsing_history}}"
label="$i18n{clearBrowsingHistory}" label="$i18n{clearBrowsingHistory}"
sub-label="[[counters_.browsing_history]]" sub-label="[[counters_.browsing_history]]"
disabled="[[clearingInProgress_]]"> disabled="[[clearingInProgress_]]"
hidden="[[isSupervised_]]">
</settings-checkbox> </settings-checkbox>
<settings-checkbox id="downloadCheckbox" <settings-checkbox id="downloadCheckbox"
pref="{{prefs.browser.clear_data.download_history}}" pref="{{prefs.browser.clear_data.download_history}}"
label="$i18n{clearDownloadHistory}" label="$i18n{clearDownloadHistory}"
sub-label="[[counters_.download_history]]" sub-label="[[counters_.download_history]]"
disabled="[[clearingInProgress_]]"> disabled="[[clearingInProgress_]]"
hidden="[[isSupervised_]]">
</settings-checkbox> </settings-checkbox>
<settings-checkbox <settings-checkbox
pref="{{prefs.browser.clear_data.cache}}" pref="{{prefs.browser.clear_data.cache}}"
......
...@@ -55,6 +55,14 @@ Polymer({ ...@@ -55,6 +55,14 @@ Polymer({
value: false, value: false,
}, },
/** @private */
isSupervised_: {
type: Boolean,
value: function() {
return loadTimeData.getBoolean('isSupervised');
},
},
/** @private */ /** @private */
showHistoryDeletionDialog_: { showHistoryDeletionDialog_: {
type: Boolean, type: Boolean,
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
'dependencies': [ 'dependencies': [
'<(DEPTH)/third_party/polymer/v1_0/components-chromium/iron-resizable-behavior/compiled_resources2.gyp:iron-resizable-behavior-extracted', '<(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:cr',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:load_time_data',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:web_ui_listener_behavior', '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:web_ui_listener_behavior',
'../device_page/compiled_resources2.gyp:keyboard', '../device_page/compiled_resources2.gyp:keyboard',
'clear_browsing_data_browser_proxy', 'clear_browsing_data_browser_proxy',
......
...@@ -112,6 +112,8 @@ void AddCommonStrings(content::WebUIDataSource* html_source, Profile* profile) { ...@@ -112,6 +112,8 @@ void AddCommonStrings(content::WebUIDataSource* html_source, Profile* profile) {
#else #else
profile->IsOffTheRecord()); profile->IsOffTheRecord());
#endif #endif
html_source->AddBoolean("isSupervised", profile->IsSupervised());
} }
void AddA11yStrings(content::WebUIDataSource* html_source) { void AddA11yStrings(content::WebUIDataSource* html_source) {
...@@ -351,8 +353,6 @@ void AddAppearanceStrings(content::WebUIDataSource* html_source, ...@@ -351,8 +353,6 @@ void AddAppearanceStrings(content::WebUIDataSource* html_source,
}; };
AddLocalizedStringsBulk(html_source, localized_strings, AddLocalizedStringsBulk(html_source, localized_strings,
arraysize(localized_strings)); arraysize(localized_strings));
html_source->AddBoolean("isSupervised", profile->IsSupervised());
} }
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
......
...@@ -229,6 +229,25 @@ cr.define('settings_privacy_page', function() { ...@@ -229,6 +229,25 @@ cr.define('settings_privacy_page', function() {
'update-counter-text', checkbox.pref.key, 'result'); 'update-counter-text', checkbox.pref.key, 'result');
assertEquals('result', checkbox.subLabel); 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