summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-11 20:36:46 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-11 20:36:46 +0000
commit837b2bc013088a294fb3d2777b2dd1a2625e2178 (patch)
tree4632ff08444037e5245a582946d178d8269062d2
parente80e72461821c53f2a84502ef1916b67669bf852 (diff)
downloadchromium_src-837b2bc013088a294fb3d2777b2dd1a2625e2178.zip
chromium_src-837b2bc013088a294fb3d2777b2dd1a2625e2178.tar.gz
chromium_src-837b2bc013088a294fb3d2777b2dd1a2625e2178.tar.bz2
chromeos: Let all users change time zone setting.
This tweaks r67504 to let all signed-in users modify the time zone system setting (rather than just the device owner). It also disables the (per-user, but still confusing to show enabled alongside a disabled time zone combobox) 24-hour clock setting for the guest user. Put more succinctly: - all signed-in users can modify time zone and 24-hour clock (time zone is systemwide while 24-hour clock is per-user) - both settings are disabled for guest user BUG=chromium-os:8176,chromium-os:10534 TEST=manual: check that i can change settings as owner and non-owner signed-in users, but that both settings are disabled when using guest account Review URL: http://codereview.chromium.org/6953003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85035 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/options/chromeos/accounts_options.js7
-rw-r--r--chrome/browser/resources/options/chromeos/system_options.js13
-rw-r--r--chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc3
-rw-r--r--chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc4
4 files changed, 20 insertions, 7 deletions
diff --git a/chrome/browser/resources/options/chromeos/accounts_options.js b/chrome/browser/resources/options/chromeos/accounts_options.js
index e213979..491c90f 100644
--- a/chrome/browser/resources/options/chromeos/accounts_options.js
+++ b/chrome/browser/resources/options/chromeos/accounts_options.js
@@ -119,6 +119,13 @@ cr.define('options', function() {
};
/**
+ * Returns whether we're currently in guest mode.
+ */
+ AccountsOptions.loggedInAsGuest = function() {
+ return localStrings.getString('logged_in_as_guest') == 'true';
+ };
+
+ /**
* Returns whether the whitelist is managed by policy or not.
*/
AccountsOptions.whitelistIsManaged = function() {
diff --git a/chrome/browser/resources/options/chromeos/system_options.js b/chrome/browser/resources/options/chromeos/system_options.js
index 84cd3b3..453accc 100644
--- a/chrome/browser/resources/options/chromeos/system_options.js
+++ b/chrome/browser/resources/options/chromeos/system_options.js
@@ -30,12 +30,15 @@ cr.define('options', function() {
*/
initializePage: function() {
OptionsPage.prototype.initializePage.call(this);
- var timezone = $('timezone-select');
- if (timezone) {
- // Disable the timezone setting for non-owners, as this is a
- // system wide setting.
- if (!AccountsOptions.currentUserIsOwner())
+
+ // Disable time-related settings if we're not logged in as a real user.
+ if (AccountsOptions.loggedInAsGuest()) {
+ var timezone = $('timezone-select');
+ if (timezone)
timezone.disabled = true;
+ var use_24hour_clock = $('use-24hour-clock');
+ if (use_24hour_clock)
+ use_24hour_clock.disabled = true;
}
$('language-button').onclick = function(event) {
diff --git a/chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc
index 585c087..4d6c005 100644
--- a/chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc
@@ -64,6 +64,9 @@ void AccountsOptionsHandler::GetLocalizedValues(
localized_strings->SetString("current_user_is_owner",
UserManager::Get()->current_user_is_owner() ?
ASCIIToUTF16("true") : ASCIIToUTF16("false"));
+ localized_strings->SetString("logged_in_as_guest",
+ UserManager::Get()->IsLoggedInAsGuest() ?
+ ASCIIToUTF16("true") : ASCIIToUTF16("false"));
localized_strings->SetString("whitelist_is_managed",
g_browser_process->local_state()->IsManagedPreference(
kAccountsPrefUsers) ? ASCIIToUTF16("true") : ASCIIToUTF16("false"));
diff --git a/chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc b/chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc
index aaf11cb..aef8774 100644
--- a/chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc
+++ b/chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc
@@ -195,8 +195,8 @@ SystemSettingsProvider::~SystemSettingsProvider() {
}
void SystemSettingsProvider::DoSet(const std::string& path, Value* in_value) {
- // Only the owner can change the time zone.
- if (!UserManager::Get()->current_user_is_owner())
+ // Non-guest users can change the time zone.
+ if (UserManager::Get()->IsLoggedInAsGuest())
return;
if (path == kSystemTimezone) {