| OLD | NEW |
| 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 #include "chrome/browser/chromeos/settings/device_settings_provider.h" | 5 #include "chrome/browser/chromeos/settings/device_settings_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 namespace chromeos { | 36 namespace chromeos { |
| 37 | 37 |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| 40 // List of settings handled by the DeviceSettingsProvider. | 40 // List of settings handled by the DeviceSettingsProvider. |
| 41 const char* kKnownSettings[] = { | 41 const char* kKnownSettings[] = { |
| 42 kAccountsPrefAllowGuest, | 42 kAccountsPrefAllowGuest, |
| 43 kAccountsPrefAllowNewUser, | 43 kAccountsPrefAllowNewUser, |
| 44 kAccountsPrefDeviceLocalAccounts, | 44 kAccountsPrefDeviceLocalAccounts, |
| 45 kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled, |
| 45 kAccountsPrefDeviceLocalAccountAutoLoginDelay, | 46 kAccountsPrefDeviceLocalAccountAutoLoginDelay, |
| 46 kAccountsPrefDeviceLocalAccountAutoLoginId, | 47 kAccountsPrefDeviceLocalAccountAutoLoginId, |
| 47 kAccountsPrefEphemeralUsersEnabled, | 48 kAccountsPrefEphemeralUsersEnabled, |
| 48 kAccountsPrefShowUserNamesOnSignIn, | 49 kAccountsPrefShowUserNamesOnSignIn, |
| 49 kAccountsPrefUsers, | 50 kAccountsPrefUsers, |
| 50 kAllowRedeemChromeOsRegistrationOffers, | 51 kAllowRedeemChromeOsRegistrationOffers, |
| 51 kAppPack, | 52 kAppPack, |
| 52 kDeviceAttestationEnabled, | 53 kDeviceAttestationEnabled, |
| 53 kDeviceOwner, | 54 kDeviceOwner, |
| 54 kIdleLogoutTimeout, | 55 kIdleLogoutTimeout, |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 else | 249 else |
| 249 NOTREACHED(); | 250 NOTREACHED(); |
| 250 } else if (prop == kAccountsPrefDeviceLocalAccountAutoLoginDelay) { | 251 } else if (prop == kAccountsPrefDeviceLocalAccountAutoLoginDelay) { |
| 251 em::DeviceLocalAccountsProto* device_local_accounts = | 252 em::DeviceLocalAccountsProto* device_local_accounts = |
| 252 device_settings_.mutable_device_local_accounts(); | 253 device_settings_.mutable_device_local_accounts(); |
| 253 int delay; | 254 int delay; |
| 254 if (value->GetAsInteger(&delay)) | 255 if (value->GetAsInteger(&delay)) |
| 255 device_local_accounts->set_auto_login_delay(delay); | 256 device_local_accounts->set_auto_login_delay(delay); |
| 256 else | 257 else |
| 257 NOTREACHED(); | 258 NOTREACHED(); |
| 259 } else if (prop == kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled) { |
| 260 em::DeviceLocalAccountsProto* device_local_accounts = |
| 261 device_settings_.mutable_device_local_accounts(); |
| 262 bool enabled; |
| 263 if (value->GetAsBoolean(&enabled)) |
| 264 device_local_accounts->set_enable_auto_login_bailout(enabled); |
| 265 else |
| 266 NOTREACHED(); |
| 258 } else if (prop == kSignedDataRoamingEnabled) { | 267 } else if (prop == kSignedDataRoamingEnabled) { |
| 259 em::DataRoamingEnabledProto* roam = | 268 em::DataRoamingEnabledProto* roam = |
| 260 device_settings_.mutable_data_roaming_enabled(); | 269 device_settings_.mutable_data_roaming_enabled(); |
| 261 bool roaming_value = false; | 270 bool roaming_value = false; |
| 262 if (value->GetAsBoolean(&roaming_value)) | 271 if (value->GetAsBoolean(&roaming_value)) |
| 263 roam->set_data_roaming_enabled(roaming_value); | 272 roam->set_data_roaming_enabled(roaming_value); |
| 264 else | 273 else |
| 265 NOTREACHED(); | 274 NOTREACHED(); |
| 266 ApplyRoamingSetting(roaming_value); | 275 ApplyRoamingSetting(roaming_value); |
| 267 } else if (prop == kSettingProxyEverywhere) { | 276 } else if (prop == kSettingProxyEverywhere) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 if (policy.device_local_accounts().has_auto_login_id()) { | 472 if (policy.device_local_accounts().has_auto_login_id()) { |
| 464 new_values_cache->SetString( | 473 new_values_cache->SetString( |
| 465 kAccountsPrefDeviceLocalAccountAutoLoginId, | 474 kAccountsPrefDeviceLocalAccountAutoLoginId, |
| 466 policy.device_local_accounts().auto_login_id()); | 475 policy.device_local_accounts().auto_login_id()); |
| 467 } | 476 } |
| 468 if (policy.device_local_accounts().has_auto_login_delay()) { | 477 if (policy.device_local_accounts().has_auto_login_delay()) { |
| 469 new_values_cache->SetInteger( | 478 new_values_cache->SetInteger( |
| 470 kAccountsPrefDeviceLocalAccountAutoLoginDelay, | 479 kAccountsPrefDeviceLocalAccountAutoLoginDelay, |
| 471 policy.device_local_accounts().auto_login_delay()); | 480 policy.device_local_accounts().auto_login_delay()); |
| 472 } | 481 } |
| 482 if (policy.device_local_accounts().has_enable_auto_login_bailout()) { |
| 483 new_values_cache->SetBoolean( |
| 484 kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled, |
| 485 policy.device_local_accounts().enable_auto_login_bailout()); |
| 486 } |
| 473 } | 487 } |
| 474 } | 488 } |
| 475 | 489 |
| 476 void DeviceSettingsProvider::DecodeKioskPolicies( | 490 void DeviceSettingsProvider::DecodeKioskPolicies( |
| 477 const em::ChromeDeviceSettingsProto& policy, | 491 const em::ChromeDeviceSettingsProto& policy, |
| 478 PrefValueMap* new_values_cache) const { | 492 PrefValueMap* new_values_cache) const { |
| 479 if (policy.has_forced_logout_timeouts()) { | 493 if (policy.has_forced_logout_timeouts()) { |
| 480 if (policy.forced_logout_timeouts().has_idle_logout_timeout()) { | 494 if (policy.forced_logout_timeouts().has_idle_logout_timeout()) { |
| 481 new_values_cache->SetInteger( | 495 new_values_cache->SetInteger( |
| 482 kIdleLogoutTimeout, | 496 kIdleLogoutTimeout, |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 void DeviceSettingsProvider::AttemptMigration() { | 886 void DeviceSettingsProvider::AttemptMigration() { |
| 873 if (device_settings_service_->HasPrivateOwnerKey()) { | 887 if (device_settings_service_->HasPrivateOwnerKey()) { |
| 874 PrefValueMap::const_iterator i; | 888 PrefValueMap::const_iterator i; |
| 875 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 889 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
| 876 DoSet(i->first, *i->second); | 890 DoSet(i->first, *i->second); |
| 877 migration_values_.Clear(); | 891 migration_values_.Clear(); |
| 878 } | 892 } |
| 879 } | 893 } |
| 880 | 894 |
| 881 } // namespace chromeos | 895 } // namespace chromeos |
| OLD | NEW |