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

Side by Side Diff: chrome/browser/resources/options2/advanced_options.js

Issue 9464053: Hide/Disable several (meaningless) options in Settings uber-page for Guest. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: No change picture button anymore Created 8 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('options', function() { 5 cr.define('options', function() {
6 6
7 var OptionsPage = options.OptionsPage; 7 var OptionsPage = options.OptionsPage;
8 8
9 // 9 //
10 // AdvancedOptions class 10 // AdvancedOptions class
(...skipping 16 matching lines...) Expand all
27 initializePage: function() { 27 initializePage: function() {
28 // Call base class implementation to starts preference initialization. 28 // Call base class implementation to starts preference initialization.
29 OptionsPage.prototype.initializePage.call(this); 29 OptionsPage.prototype.initializePage.call(this);
30 30
31 $('advanced-section-back-button').onclick = 31 $('advanced-section-back-button').onclick =
32 OptionsPage.navigateToPage.bind(OptionsPage, this.parentPage.name); 32 OptionsPage.navigateToPage.bind(OptionsPage, this.parentPage.name);
33 33
34 // Date and time section (CrOS only). 34 // Date and time section (CrOS only).
35 if (cr.isChromeOS && AccountsOptions.loggedInAsGuest()) { 35 if (cr.isChromeOS && AccountsOptions.loggedInAsGuest()) {
36 // Disable time-related settings if we're not logged in as a real user. 36 // Disable time-related settings if we're not logged in as a real user.
37 $('timezone-select').disabled = true; 37 AccountsOptions.disableElementsForGuest($('timezone-select'));
38 $('use-24hour-clock').disabled = true; 38 AccountsOptions.disableElementsForGuest($('use-24hour-clock'));
39 } 39 }
40 40
41 // Privacy section. 41 // Privacy section.
42 $('privacyContentSettingsButton').onclick = function(event) { 42 $('privacyContentSettingsButton').onclick = function(event) {
43 OptionsPage.navigateToPage('content'); 43 OptionsPage.navigateToPage('content');
44 OptionsPage.showTab($('cookies-nav-tab')); 44 OptionsPage.showTab($('cookies-nav-tab'));
45 chrome.send('coreOptionsUserMetricsAction', 45 chrome.send('coreOptionsUserMetricsAction',
46 ['Options_ContentSettings']); 46 ['Options_ContentSettings']);
47 }; 47 };
48 $('privacyClearDataButton').onclick = function(event) { 48 $('privacyClearDataButton').onclick = function(event) {
49 OptionsPage.navigateToPage('clearBrowserData'); 49 OptionsPage.navigateToPage('clearBrowserData');
50 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); 50 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']);
51 }; 51 };
52 // 'metricsReportingEnabled' element is only present on Chrome branded 52 // 'metricsReportingEnabled' element is only present on Chrome branded
53 // builds. 53 // builds.
54 if ($('metricsReportingEnabled')) { 54 if ($('metricsReportingEnabled')) {
55 $('metricsReportingEnabled').onclick = function(event) { 55 $('metricsReportingEnabled').onclick = function(event) {
56 chrome.send('metricsReportingCheckboxAction', 56 chrome.send('metricsReportingCheckboxAction',
57 [String(event.target.checked)]); 57 [String(event.target.checked)]);
58 }; 58 };
59 } 59 }
60 if (cr.isChromeOS && AccountsOptions.loggedInAsGuest()) {
61 AccountsOptions.disableElementsForGuest($('searchSuggestEnabledGroup'));
62 AccountsOptions.disableElementsForGuest(
63 $('dnsPrefetchingEnabledGroup'));
64 }
60 65
61 // Bluetooth (CrOS only). 66 // Bluetooth (CrOS only).
62 if (cr.isChromeOS) { 67 if (cr.isChromeOS) {
63 options.system.bluetooth.BluetoothDeviceList.decorate( 68 options.system.bluetooth.BluetoothDeviceList.decorate(
64 $('bluetooth-paired-devices-list')); 69 $('bluetooth-paired-devices-list'));
65 70
66 $('bluetooth-add-device').onclick = function(event) { 71 $('bluetooth-add-device').onclick = function(event) {
67 findBluetoothDevices_(true); 72 findBluetoothDevices_(true);
68 OptionsPage.navigateToPage('bluetooth'); 73 OptionsPage.navigateToPage('bluetooth');
69 }; 74 };
(...skipping 29 matching lines...) Expand all
99 OptionsPage.navigateToPage('autofill'); 104 OptionsPage.navigateToPage('autofill');
100 chrome.send('coreOptionsUserMetricsAction', 105 chrome.send('coreOptionsUserMetricsAction',
101 ['Options_ShowAutofillSettings']); 106 ['Options_ShowAutofillSettings']);
102 }; 107 };
103 $('manage-passwords').onclick = function(event) { 108 $('manage-passwords').onclick = function(event) {
104 OptionsPage.navigateToPage('passwords'); 109 OptionsPage.navigateToPage('passwords');
105 OptionsPage.showTab($('passwords-nav-tab')); 110 OptionsPage.showTab($('passwords-nav-tab'));
106 chrome.send('coreOptionsUserMetricsAction', 111 chrome.send('coreOptionsUserMetricsAction',
107 ['Options_ShowPasswordManager']); 112 ['Options_ShowPasswordManager']);
108 }; 113 };
109 if (AdvancedOptions.GuestModeActive()) { 114 if (cr.isChromeOS && AccountsOptions.loggedInAsGuest()) {
110 // Disable and turn off Autofill in guest mode. 115 // Disable and turn off Autofill in guest mode.
111 var autofillEnabled = $('autofill-enabled'); 116 var autofillEnabled = $('autofill-enabled');
112 autofillEnabled.disabled = true; 117 autofillEnabled.disabled = true;
113 autofillEnabled.checked = false; 118 autofillEnabled.checked = false;
114 cr.dispatchSimpleEvent(autofillEnabled, 'change'); 119 cr.dispatchSimpleEvent(autofillEnabled, 'change');
115 $('autofill-settings').disabled = true; 120 $('autofill-settings').disabled = true;
116 121
117 // Disable and turn off Password Manager in guest mode. 122 // Disable and turn off Password Manager in guest mode.
118 var passwordManagerEnabled = $('password-manager-enabled'); 123 var passwordManagerEnabled = $('password-manager-enabled');
119 passwordManagerEnabled.disabled = true; 124 passwordManagerEnabled.disabled = true;
120 passwordManagerEnabled.checked = false; 125 passwordManagerEnabled.checked = false;
121 cr.dispatchSimpleEvent(passwordManagerEnabled, 'change'); 126 cr.dispatchSimpleEvent(passwordManagerEnabled, 'change');
122 $('manage-passwords').disabled = true; 127 $('manage-passwords').disabled = true;
123 128
124 // Hide the entire section on ChromeOS 129 // Hide the entire section on ChromeOS
125 if (cr.isChromeOS) 130 AccountsOptions.disableElementsForGuest(
126 $('passwords-and-autofill-section').hidden = true; 131 $('passwords-and-autofill-section'));
127 } 132 }
133
128 $('mac-passwords-warning').hidden = 134 $('mac-passwords-warning').hidden =
129 !(localStrings.getString('macPasswordsWarning')); 135 !(localStrings.getString('macPasswordsWarning'));
130 136
131 // Network section. 137 // Network section.
132 if (!cr.isChromeOS) { 138 if (!cr.isChromeOS) {
133 $('proxiesConfigureButton').onclick = function(event) { 139 $('proxiesConfigureButton').onclick = function(event) {
134 chrome.send('showNetworkProxySettings'); 140 chrome.send('showNetworkProxySettings');
135 }; 141 };
136 } 142 }
137 143
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 }; 259 };
254 260
255 AdvancedOptions.SetMetricsReportingSettingVisibility = function(visible) { 261 AdvancedOptions.SetMetricsReportingSettingVisibility = function(visible) {
256 if (visible) { 262 if (visible) {
257 $('metricsReportingSetting').style.display = 'block'; 263 $('metricsReportingSetting').style.display = 'block';
258 } else { 264 } else {
259 $('metricsReportingSetting').style.display = 'none'; 265 $('metricsReportingSetting').style.display = 'none';
260 } 266 }
261 }; 267 };
262 268
263 /**
264 * Returns whether the browser in guest mode. Some features are disabled or
265 * hidden in guest mode.
266 * @return {boolean} True if guest mode is currently active.
267 */
268 AdvancedOptions.GuestModeActive = function() {
269 return cr.commandLine && cr.commandLine.options['--bwsi'];
270 };
271
272 // Set the font size selected item. 269 // Set the font size selected item.
273 AdvancedOptions.SetFontSize = function(font_size_value) { 270 AdvancedOptions.SetFontSize = function(font_size_value) {
274 var selectCtl = $('defaultFontSize'); 271 var selectCtl = $('defaultFontSize');
275 for (var i = 0; i < selectCtl.options.length; i++) { 272 for (var i = 0; i < selectCtl.options.length; i++) {
276 if (selectCtl.options[i].value == font_size_value) { 273 if (selectCtl.options[i].value == font_size_value) {
277 selectCtl.selectedIndex = i; 274 selectCtl.selectedIndex = i;
278 if ($('Custom')) 275 if ($('Custom'))
279 selectCtl.remove($('Custom').index); 276 selectCtl.remove($('Custom').index);
280 return; 277 return;
281 } 278 }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 if (device.pairing) 452 if (device.pairing)
456 BluetoothPairing.showDialog(device); 453 BluetoothPairing.showDialog(device);
457 }; 454 };
458 455
459 // Export 456 // Export
460 return { 457 return {
461 AdvancedOptions: AdvancedOptions 458 AdvancedOptions: AdvancedOptions
462 }; 459 };
463 460
464 }); 461 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698