| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 kReportDeviceLocation, | 68 kReportDeviceLocation, |
| 69 kReportDeviceNetworkInterfaces, | 69 kReportDeviceNetworkInterfaces, |
| 70 kReportDeviceVersionInfo, | 70 kReportDeviceVersionInfo, |
| 71 kScreenSaverExtensionId, | 71 kScreenSaverExtensionId, |
| 72 kScreenSaverTimeout, | 72 kScreenSaverTimeout, |
| 73 kSignedDataRoamingEnabled, | 73 kSignedDataRoamingEnabled, |
| 74 kStartUpFlags, | 74 kStartUpFlags, |
| 75 kStartUpUrls, | 75 kStartUpUrls, |
| 76 kStatsReportingPref, | 76 kStatsReportingPref, |
| 77 kSystemTimezonePolicy, | 77 kSystemTimezonePolicy, |
| 78 kSystemUse24HourClock, |
| 78 kUpdateDisabled, | 79 kUpdateDisabled, |
| 79 kVariationsRestrictParameter, | 80 kVariationsRestrictParameter, |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 // Legacy policy file location. Used to detect migration from pre v12 ChromeOS. | 83 // Legacy policy file location. Used to detect migration from pre v12 ChromeOS. |
| 83 const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences"; | 84 const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences"; |
| 84 | 85 |
| 85 bool HasOldMetricsFile() { | 86 bool HasOldMetricsFile() { |
| 86 // TODO(pastarmovj): Remove this once migration is not needed anymore. | 87 // TODO(pastarmovj): Remove this once migration is not needed anymore. |
| 87 // If the value is not set we should try to migrate legacy consent file. | 88 // If the value is not set we should try to migrate legacy consent file. |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 flags_proto->Clear(); | 369 flags_proto->Clear(); |
| 369 const base::ListValue* flags; | 370 const base::ListValue* flags; |
| 370 if (value->GetAsList(&flags)) { | 371 if (value->GetAsList(&flags)) { |
| 371 for (base::ListValue::const_iterator i = flags->begin(); | 372 for (base::ListValue::const_iterator i = flags->begin(); |
| 372 i != flags->end(); ++i) { | 373 i != flags->end(); ++i) { |
| 373 std::string flag; | 374 std::string flag; |
| 374 if ((*i)->GetAsString(&flag)) | 375 if ((*i)->GetAsString(&flag)) |
| 375 flags_proto->add_flags(flag); | 376 flags_proto->add_flags(flag); |
| 376 } | 377 } |
| 377 } | 378 } |
| 379 } else if (prop == kSystemUse24HourClock) { |
| 380 em::SystemUse24HourClockProto* use_24hour_clock_proto = |
| 381 device_settings_.mutable_use_24hour_clock(); |
| 382 use_24hour_clock_proto->Clear(); |
| 383 bool use_24hour_clock_value; |
| 384 if (value->GetAsBoolean(&use_24hour_clock_value)) { |
| 385 use_24hour_clock_proto->set_use_24hour_clock(use_24hour_clock_value); |
| 386 } else { |
| 387 NOTREACHED(); |
| 388 } |
| 378 } else { | 389 } else { |
| 379 // The remaining settings don't support Set(), since they are not | 390 // The remaining settings don't support Set(), since they are not |
| 380 // intended to be customizable by the user: | 391 // intended to be customizable by the user: |
| 381 // kAccountsPrefSupervisedUsersEnabled | 392 // kAccountsPrefSupervisedUsersEnabled |
| 382 // kAppPack | 393 // kAppPack |
| 383 // kDeviceAttestationEnabled | 394 // kDeviceAttestationEnabled |
| 384 // kDeviceOwner | 395 // kDeviceOwner |
| 385 // kIdleLogoutTimeout | 396 // kIdleLogoutTimeout |
| 386 // kIdleLogoutWarningDuration | 397 // kIdleLogoutWarningDuration |
| 387 // kReleaseChannelDelegated | 398 // kReleaseChannelDelegated |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 policy.release_channel().release_channel_delegated()); | 708 policy.release_channel().release_channel_delegated()); |
| 698 | 709 |
| 699 if (policy.has_system_timezone()) { | 710 if (policy.has_system_timezone()) { |
| 700 if (policy.system_timezone().has_timezone()) { | 711 if (policy.system_timezone().has_timezone()) { |
| 701 new_values_cache->SetString( | 712 new_values_cache->SetString( |
| 702 kSystemTimezonePolicy, | 713 kSystemTimezonePolicy, |
| 703 policy.system_timezone().timezone()); | 714 policy.system_timezone().timezone()); |
| 704 } | 715 } |
| 705 } | 716 } |
| 706 | 717 |
| 718 if (policy.has_use_24hour_clock()) { |
| 719 if (policy.use_24hour_clock().has_use_24hour_clock()) { |
| 720 new_values_cache->SetBoolean( |
| 721 kSystemUse24HourClock, policy.use_24hour_clock().use_24hour_clock()); |
| 722 } |
| 723 } |
| 724 |
| 707 if (policy.has_allow_redeem_offers()) { | 725 if (policy.has_allow_redeem_offers()) { |
| 708 new_values_cache->SetBoolean( | 726 new_values_cache->SetBoolean( |
| 709 kAllowRedeemChromeOsRegistrationOffers, | 727 kAllowRedeemChromeOsRegistrationOffers, |
| 710 policy.allow_redeem_offers().allow_redeem_offers()); | 728 policy.allow_redeem_offers().allow_redeem_offers()); |
| 711 } else { | 729 } else { |
| 712 new_values_cache->SetBoolean( | 730 new_values_cache->SetBoolean( |
| 713 kAllowRedeemChromeOsRegistrationOffers, | 731 kAllowRedeemChromeOsRegistrationOffers, |
| 714 true); | 732 true); |
| 715 } | 733 } |
| 716 | 734 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 void DeviceSettingsProvider::AttemptMigration() { | 997 void DeviceSettingsProvider::AttemptMigration() { |
| 980 if (device_settings_service_->HasPrivateOwnerKey()) { | 998 if (device_settings_service_->HasPrivateOwnerKey()) { |
| 981 PrefValueMap::const_iterator i; | 999 PrefValueMap::const_iterator i; |
| 982 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 1000 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
| 983 DoSet(i->first, *i->second); | 1001 DoSet(i->first, *i->second); |
| 984 migration_values_.Clear(); | 1002 migration_values_.Clear(); |
| 985 } | 1003 } |
| 986 } | 1004 } |
| 987 | 1005 |
| 988 } // namespace chromeos | 1006 } // namespace chromeos |
| OLD | NEW |