Index: chrome/browser/resources/options2/browser_options.js |
diff --git a/chrome/browser/resources/options2/browser_options.js b/chrome/browser/resources/options2/browser_options.js |
index ab34db5496e378d44e1e84b13310a47ff9bae49b..d68ce9cbc6c2c3bc204b1ecab8ca25aa092d0c97 100644 |
--- a/chrome/browser/resources/options2/browser_options.js |
+++ b/chrome/browser/resources/options2/browser_options.js |
@@ -117,6 +117,17 @@ cr.define('options', function() { |
$('themes-reset').onclick = function(event) { |
chrome.send('themesReset'); |
}; |
+ if (cr.isChromeOS) { |
+ // Appearance section. |
+ if (AccountsOptions.loggedInAsGuest()) { |
James Hawkins
2012/03/05 17:07:12
Combine this if with if (cr.isChromeOS).
Denis Kuznetsov (DE-MUC)
2012/03/12 10:32:15
Done.
|
+ AccountsOptions.disableElementsForGuest( |
+ $('home-page-select-container')); |
+ AccountsOptions.disableElementsForGuest( |
+ $('bookmarkbar-show-on-all-tabs-group')); |
+ // Search section |
+ AccountsOptions.disableElementsForGuest($('instant-setting')); |
+ } |
+ } |
// Device section (ChromeOS only). |
if (cr.isChromeOS) { |
@@ -201,24 +212,25 @@ cr.define('options', function() { |
}; |
if (cr.isChromeOS) { |
- // Username (canonical email) of the currently logged in user or |
- // |kGuestUser| if a guest session is active. |
- this.username_ = localStrings.getString('username'); |
- |
- this.updateAccountPicture_(); |
- |
- if (cr.commandLine && cr.commandLine.options['--bwsi']) { |
+ if (AccountsOptions.loggedInAsGuest()) { |
// Disable the screen lock checkbox in guest mode. |
- $('enable-screen-lock').disabled = true; |
+ AccountsOptions.disableElementsForGuest($('enable-screen-lock')); |
- // Hide the startup section in Guest mode. |
+ // Hide the startup and users sections in Guest mode. |
$('startup-section').hidden = true; |
+ $('users-section').hidden = true; |
} else { |
$('account-picture-wrapper').onclick = function(event) { |
OptionsPage.navigateToPage('changePicture'); |
}; |
} |
+ // Username (canonical email) of the currently logged in user or |
+ // |kGuestUser| if a guest session is active. |
+ this.username_ = localStrings.getString('username'); |
+ |
+ this.updateAccountPicture_(); |
+ |
$('manage-accounts-button').onclick = function(event) { |
OptionsPage.navigateToPage('accounts'); |
chrome.send('coreOptionsUserMetricsAction', |
@@ -253,8 +265,8 @@ cr.define('options', function() { |
// Date and time section (CrOS only). |
if (cr.isChromeOS && AccountsOptions.loggedInAsGuest()) { |
// Disable time-related settings if we're not logged in as a real user. |
- $('timezone-select').disabled = true; |
- $('use-24hour-clock').disabled = true; |
+ AccountsOptions.disableElementsForGuest($('timezone-value-group')); |
+ AccountsOptions.disableElementsForGuest($('use-24hour-clock')); |
} |
// Privacy section. |
@@ -277,6 +289,14 @@ cr.define('options', function() { |
}; |
} |
+ if (cr.isChromeOS && AccountsOptions.loggedInAsGuest()) { |
+ AccountsOptions.disableElementsForGuest( |
+ $('search-suggest-enabled-group')); |
+ AccountsOptions.disableElementsForGuest( |
+ $('dns-prefetching-enabled-group')); |
+ } |
+ |
+ |
// Bluetooth (CrOS only). |
if (cr.isChromeOS) { |
options.system.bluetooth.BluetoothDeviceList.decorate( |
@@ -323,7 +343,7 @@ cr.define('options', function() { |
chrome.send('coreOptionsUserMetricsAction', |
['Options_ShowPasswordManager']); |
}; |
- if (this.guestModeActive_()) { |
+ if (cr.isChromeOS && AccountsOptions.loggedInAsGuest()) { |
// Disable and turn off Autofill in guest mode. |
var autofillEnabled = $('autofill-enabled'); |
autofillEnabled.disabled = true; |
@@ -339,8 +359,8 @@ cr.define('options', function() { |
$('manage-passwords').disabled = true; |
// Hide the entire section on ChromeOS |
- if (cr.isChromeOS) |
- $('passwords-and-autofill-section').hidden = true; |
+ AccountsOptions.disableElementsForGuest( |
+ $('passwords-and-autofill-section')); |
} |
$('mac-passwords-warning').hidden = |
!(localStrings.getString('macPasswordsWarning')); |
@@ -952,16 +972,6 @@ cr.define('options', function() { |
}, |
/** |
- * Returns whether the browser in guest mode. Some features are disabled or |
- * hidden in guest mode. |
- * @return {boolean} True if guest mode is currently active. |
- * @private |
- */ |
- guestModeActive_: function() { |
- return cr.commandLine && cr.commandLine.options['--bwsi']; |
- }, |
- |
- /** |
* Set the font size selected item. |
* @private |
*/ |
@@ -1187,7 +1197,6 @@ cr.define('options', function() { |
[ |
'addBluetoothDevice', |
'getStartStopSyncButton', |
- 'guestModeActive', |
'hideBluetoothSettings', |
'removeCloudPrintConnectorSection', |
'setAutoOpenFileTypesDisabledAttribute', |