summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbartfab@google.com <bartfab@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-09 12:31:15 +0000
committerbartfab@google.com <bartfab@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-09 12:31:15 +0000
commit12a0ac102d0fabd5e01dd7195a1581b8bf95441e (patch)
tree2c3c5223c65853e8370f59cbe124e01d697852a2
parentce2b3aac9c878e0b81466f9c5a395fba66dd2770 (diff)
downloadchromium_src-12a0ac102d0fabd5e01dd7195a1581b8bf95441e.zip
chromium_src-12a0ac102d0fabd5e01dd7195a1581b8bf95441e.tar.gz
chromium_src-12a0ac102d0fabd5e01dd7195a1581b8bf95441e.tar.bz2
Make ephemeral user policy available through CrosSettings
This CL makes the ephemeral user device policy available via CrosSettings. BUG=chromium-os:20004 TEST=unit_test CrosSettingsTest.SetEphemeralUsers Review URL: http://codereview.chromium.org/9362015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121229 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/cros_settings_names.cc1
-rw-r--r--chrome/browser/chromeos/cros_settings_names.h1
-rw-r--r--chrome/browser/chromeos/cros_settings_unittest.cc10
-rw-r--r--chrome/browser/chromeos/device_settings_provider.cc18
-rw-r--r--chrome/browser/chromeos/stub_cros_settings_provider.cc1
5 files changed, 29 insertions, 2 deletions
diff --git a/chrome/browser/chromeos/cros_settings_names.cc b/chrome/browser/chromeos/cros_settings_names.cc
index 72d169a2..d9b6485 100644
--- a/chrome/browser/chromeos/cros_settings_names.cc
+++ b/chrome/browser/chromeos/cros_settings_names.cc
@@ -14,6 +14,7 @@ const char kAccountsPrefAllowNewUser[] = "cros.accounts.allowGuest";
const char kAccountsPrefShowUserNamesOnSignIn[]
= "cros.accounts.showUserNamesOnSignIn";
const char kAccountsPrefUsers[] = "cros.accounts.users";
+const char kAccountsPrefEphemeralUsers[] = "cros.accounts.ephemeralUsers";
// Name of signed setting persisted on device, writeable only by owner.
const char kSettingProxyEverywhere[] = "cros.proxy.everywhere";
diff --git a/chrome/browser/chromeos/cros_settings_names.h b/chrome/browser/chromeos/cros_settings_names.h
index a45701d6..0d49aac 100644
--- a/chrome/browser/chromeos/cros_settings_names.h
+++ b/chrome/browser/chromeos/cros_settings_names.h
@@ -14,6 +14,7 @@ extern const char kAccountsPrefAllowGuest[];
extern const char kAccountsPrefAllowNewUser[];
extern const char kAccountsPrefShowUserNamesOnSignIn[];
extern const char kAccountsPrefUsers[];
+extern const char kAccountsPrefEphemeralUsers[];
extern const char kSettingProxyEverywhere[];
diff --git a/chrome/browser/chromeos/cros_settings_unittest.cc b/chrome/browser/chromeos/cros_settings_unittest.cc
index 783d372..7166a30 100644
--- a/chrome/browser/chromeos/cros_settings_unittest.cc
+++ b/chrome/browser/chromeos/cros_settings_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -225,4 +225,12 @@ TEST_F(CrosSettingsTest, SetOwner) {
FetchPref(kDeviceOwner);
}
+TEST_F(CrosSettingsTest, SetEphemeralUsers) {
+ base::FundamentalValue ephemeral_users(true);
+ AddExpectation(kAccountsPrefEphemeralUsers,
+ base::Value::CreateBooleanValue(true));
+ SetPref(kAccountsPrefEphemeralUsers, &ephemeral_users);
+ FetchPref(kAccountsPrefEphemeralUsers);
+}
+
} // namespace chromeos
diff --git a/chrome/browser/chromeos/device_settings_provider.cc b/chrome/browser/chromeos/device_settings_provider.cc
index 1d1b892..24b5e90 100644
--- a/chrome/browser/chromeos/device_settings_provider.cc
+++ b/chrome/browser/chromeos/device_settings_provider.cc
@@ -40,6 +40,7 @@ const char* kBooleanSettings[] = {
kAccountsPrefAllowNewUser,
kAccountsPrefAllowGuest,
kAccountsPrefShowUserNamesOnSignIn,
+ kAccountsPrefEphemeralUsers,
kSignedDataRoamingEnabled,
kStatsReportingPref,
kReportDeviceVersionInfo,
@@ -283,6 +284,13 @@ void DeviceSettingsProvider::SetInPolicy() {
if ((*i)->GetAsString(&email))
whitelist_proto->add_user_whitelist(email.c_str());
}
+ } else if (prop == kAccountsPrefEphemeralUsers) {
+ em::EphemeralUsersProto* ephemeral_users = pol.mutable_ephemeral_users();
+ bool ephemeral_users_value = false;
+ if (value->GetAsBoolean(&ephemeral_users_value))
+ ephemeral_users->set_ephemeral_users(ephemeral_users_value);
+ else
+ NOTREACHED();
} else {
// kReportDeviceVersionInfo, kReportDeviceActivityTimes, and
// kReportDeviceBootMode do not support being set in the policy, since
@@ -341,7 +349,9 @@ void DeviceSettingsProvider::UpdateValuesCache() {
// For all our boolean settings the following is applicable:
// true is default permissive value and false is safe prohibitive value.
- // Exception: kSignedDataRoamingEnabled which has default value of false.
+ // Exceptions:
+ // kSignedDataRoamingEnabled has a default value of false.
+ // kAccountsPrefEphemeralUsers has a default value of false.
if (pol.has_allow_new_users() &&
pol.allow_new_users().has_allow_new_users() &&
pol.allow_new_users().allow_new_users()) {
@@ -376,6 +386,12 @@ void DeviceSettingsProvider::UpdateValuesCache() {
pol.data_roaming_enabled().has_data_roaming_enabled() &&
pol.data_roaming_enabled().data_roaming_enabled());
+ new_values_cache.SetBoolean(
+ kAccountsPrefEphemeralUsers,
+ pol.has_ephemeral_users() &&
+ pol.ephemeral_users().has_ephemeral_users() &&
+ pol.ephemeral_users().ephemeral_users());
+
// TODO(cmasone): NOTIMPLEMENTED() once http://crosbug.com/13052 is fixed.
std::string serialized;
if (pol.has_device_proxy_settings() &&
diff --git a/chrome/browser/chromeos/stub_cros_settings_provider.cc b/chrome/browser/chromeos/stub_cros_settings_provider.cc
index 2ae3a3d..8f2966a 100644
--- a/chrome/browser/chromeos/stub_cros_settings_provider.cc
+++ b/chrome/browser/chromeos/stub_cros_settings_provider.cc
@@ -19,6 +19,7 @@ const char* kHandledSettings[] = {
kAccountsPrefAllowNewUser,
kAccountsPrefShowUserNamesOnSignIn,
kAccountsPrefUsers,
+ kAccountsPrefEphemeralUsers,
kDeviceOwner,
kReleaseChannel,
kReportDeviceVersionInfo,