Index: chrome/browser/chromeos/device_settings_provider.cc |
diff --git a/chrome/browser/chromeos/device_settings_provider.cc b/chrome/browser/chromeos/device_settings_provider.cc |
index e65ba0373dca2ec9ecf35a2804b6067b477781f6..10a60d0cb9338ecc57d3961e8352547a19fbe805 100644 |
--- a/chrome/browser/chromeos/device_settings_provider.cc |
+++ b/chrome/browser/chromeos/device_settings_provider.cc |
@@ -45,10 +45,14 @@ const char* kKnownSettings[] = { |
kAccountsPrefUsers, |
kAppPack, |
kDeviceOwner, |
+ kIdleLogoutTimeout, |
+ kIdleLogoutWarningDuration, |
kReleaseChannel, |
kReportDeviceActivityTimes, |
kReportDeviceBootMode, |
kReportDeviceVersionInfo, |
+ kScreenSaverExtensionId, |
+ kScreenSaverTimeout, |
kSettingProxyEverywhere, |
kSignedDataRoamingEnabled, |
kStatsReportingPref, |
@@ -275,11 +279,16 @@ void DeviceSettingsProvider::SetInPolicy() { |
NOTREACHED(); |
} else { |
// The remaining settings don't support Set(), since they are not |
- // intended to be customizable by the user: |
+ // intended to be customizable by the user yet: |
Mattias Nissler (ping if slow)
2012/03/01 19:58:10
The yet is not accurate. Put it in parens at least
pastarmovj
2012/03/05 17:02:55
Done.
|
// kAppPack |
+ // kIdleLogoutTimeout, |
+ // kIdleLogoutWarningDuration, |
// kReportDeviceVersionInfo |
// kReportDeviceActivityTimes |
// kReportDeviceBootMode |
+ // kScreenSaverExtensionId, |
+ // kScreenSaverTimeout, |
+ |
NOTREACHED(); |
} |
data.set_policy_value(pol.SerializeAsString()); |
@@ -332,6 +341,10 @@ void DeviceSettingsProvider::UpdateValuesCache() { |
em::ChromeDeviceSettingsProto pol; |
pol.ParseFromString(data.policy_value()); |
+ // -------------------- |
+ // Boolean Policies |
+ // -------------------- |
Mattias Nissler (ping if slow)
2012/03/01 19:58:10
Instead of doing this, how about actually breaking
pastarmovj
2012/03/05 17:02:55
Done.
|
+ |
// For all our boolean settings the following is applicable: |
// true is default permissive value and false is safe prohibitive value. |
// Exceptions: |
@@ -378,6 +391,54 @@ void DeviceSettingsProvider::UpdateValuesCache() { |
pol.ephemeral_users_enabled().has_ephemeral_users_enabled() && |
pol.ephemeral_users_enabled().ephemeral_users_enabled()); |
+ if (pol.has_device_reporting()) { |
+ if (pol.device_reporting().has_report_version_info()) { |
+ new_values_cache.SetBoolean(kReportDeviceVersionInfo, |
+ pol.device_reporting().report_version_info()); |
+ } |
+ // TODO(dubroy): Re-add device activity time policy here when the UI |
+ // to notify the user has been implemented (http://crosbug.com/26252). |
+ if (pol.device_reporting().has_report_boot_mode()) { |
+ new_values_cache.SetBoolean(kReportDeviceBootMode, |
+ pol.device_reporting().report_boot_mode()); |
+ } |
+ } |
+ |
+ if (pol.has_metrics_enabled()) { |
+ new_values_cache.SetBoolean(kStatsReportingPref, |
+ pol.metrics_enabled().metrics_enabled()); |
+ } else { |
+ new_values_cache.SetBoolean(kStatsReportingPref, HasOldMetricsFile()); |
+ } |
+ |
+ // -------------------- |
+ // Integer Policies |
+ // -------------------- |
+ |
+ if (pol.has_screen_saver() && |
+ pol.screen_saver().has_screen_saver_timeout()) { |
+ new_values_cache.SetInteger(kScreenSaverTimeout, |
+ pol.screen_saver().screen_saver_timeout()); |
+ } |
+ |
+ if (pol.has_forced_logout_timeouts() && |
+ pol.forced_logout_timeouts().has_idle_logout_timeout()) { |
+ new_values_cache.SetInteger( |
+ kIdleLogoutTimeout, |
+ pol.forced_logout_timeouts().idle_logout_timeout()); |
+ } |
+ |
+ if (pol.has_forced_logout_timeouts() && |
+ pol.forced_logout_timeouts().has_idle_logout_warning_duration()) { |
+ new_values_cache.SetInteger( |
+ kIdleLogoutWarningDuration, |
+ pol.forced_logout_timeouts().idle_logout_warning_duration()); |
+ } |
+ |
+ // -------------------- |
+ // String Policies |
+ // -------------------- |
+ |
// TODO(cmasone): NOTIMPLEMENTED() once http://crosbug.com/13052 is fixed. |
std::string serialized; |
if (pol.has_device_proxy_settings() && |
@@ -394,13 +455,15 @@ void DeviceSettingsProvider::UpdateValuesCache() { |
pol.release_channel().release_channel()); |
} |
- if (pol.has_metrics_enabled()) { |
- new_values_cache.SetBoolean(kStatsReportingPref, |
- pol.metrics_enabled().metrics_enabled()); |
- } else { |
- new_values_cache.SetBoolean(kStatsReportingPref, HasOldMetricsFile()); |
+ if (pol.has_screen_saver() && |
+ pol.screen_saver().has_screen_saver_extension_id()) { |
+ new_values_cache.SetString(kScreenSaverExtensionId, |
+ pol.screen_saver().screen_saver_extension_id()); |
} |
+ // -------------------- |
+ // List Policies |
+ // -------------------- |
base::ListValue* list = new base::ListValue(); |
const em::UserWhitelistProto& whitelist_proto = pol.user_whitelist(); |
const RepeatedPtrField<std::string>& whitelist = |
@@ -411,19 +474,6 @@ void DeviceSettingsProvider::UpdateValuesCache() { |
} |
new_values_cache.SetValue(kAccountsPrefUsers, list); |
- if (pol.has_device_reporting()) { |
- if (pol.device_reporting().has_report_version_info()) { |
- new_values_cache.SetBoolean(kReportDeviceVersionInfo, |
- pol.device_reporting().report_version_info()); |
- } |
- // TODO(dubroy): Re-add device activity time policy here when the UI |
- // to notify the user has been implemented (http://crosbug.com/26252). |
- if (pol.device_reporting().has_report_boot_mode()) { |
- new_values_cache.SetBoolean(kReportDeviceBootMode, |
- pol.device_reporting().report_boot_mode()); |
- } |
- } |
- |
if (pol.has_app_pack()) { |
typedef RepeatedPtrField<em::AppPackEntryProto> proto_type; |
base::ListValue* list = new base::ListValue; |