| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 kReportDeviceLocation, | 60 kReportDeviceLocation, |
| 61 kReportDeviceVersionInfo, | 61 kReportDeviceVersionInfo, |
| 62 kScreenSaverExtensionId, | 62 kScreenSaverExtensionId, |
| 63 kScreenSaverTimeout, | 63 kScreenSaverTimeout, |
| 64 kSettingProxyEverywhere, | 64 kSettingProxyEverywhere, |
| 65 kSignedDataRoamingEnabled, | 65 kSignedDataRoamingEnabled, |
| 66 kStartUpUrls, | 66 kStartUpUrls, |
| 67 kStatsReportingPref, | 67 kStatsReportingPref, |
| 68 kSystemTimezonePolicy, | 68 kSystemTimezonePolicy, |
| 69 kStartUpFlags, | 69 kStartUpFlags, |
| 70 kDeviceAttestationEnabled, |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 // Legacy policy file location. Used to detect migration from pre v12 ChromeOS. | 73 // Legacy policy file location. Used to detect migration from pre v12 ChromeOS. |
| 73 const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences"; | 74 const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences"; |
| 74 | 75 |
| 75 bool HasOldMetricsFile() { | 76 bool HasOldMetricsFile() { |
| 76 // TODO(pastarmovj): Remove this once migration is not needed anymore. | 77 // TODO(pastarmovj): Remove this once migration is not needed anymore. |
| 77 // If the value is not set we should try to migrate legacy consent file. | 78 // If the value is not set we should try to migrate legacy consent file. |
| 78 // Loading consent file state causes us to do blocking IO on UI thread. | 79 // Loading consent file state causes us to do blocking IO on UI thread. |
| 79 // Temporarily allow it until we fix http://crbug.com/62626 | 80 // Temporarily allow it until we fix http://crbug.com/62626 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 i != flags->end(); ++i) { | 334 i != flags->end(); ++i) { |
| 334 std::string flag; | 335 std::string flag; |
| 335 if ((*i)->GetAsString(&flag)) | 336 if ((*i)->GetAsString(&flag)) |
| 336 flags_proto->add_flags(flag); | 337 flags_proto->add_flags(flag); |
| 337 } | 338 } |
| 338 } | 339 } |
| 339 } else { | 340 } else { |
| 340 // The remaining settings don't support Set(), since they are not | 341 // The remaining settings don't support Set(), since they are not |
| 341 // intended to be customizable by the user: | 342 // intended to be customizable by the user: |
| 342 // kAppPack | 343 // kAppPack |
| 344 // kDeviceAttestationEnabled |
| 343 // kDeviceOwner | 345 // kDeviceOwner |
| 344 // kIdleLogoutTimeout | 346 // kIdleLogoutTimeout |
| 345 // kIdleLogoutWarningDuration | 347 // kIdleLogoutWarningDuration |
| 346 // kReleaseChannelDelegated | 348 // kReleaseChannelDelegated |
| 347 // kReportDeviceVersionInfo | 349 // kReportDeviceVersionInfo |
| 348 // kReportDeviceActivityTimes | 350 // kReportDeviceActivityTimes |
| 349 // kReportDeviceBootMode | 351 // kReportDeviceBootMode |
| 350 // kReportDeviceLocation | 352 // kReportDeviceLocation |
| 351 // kScreenSaverExtensionId | 353 // kScreenSaverExtensionId |
| 352 // kScreenSaverTimeout | 354 // kScreenSaverTimeout |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 | 610 |
| 609 if (policy.has_allow_redeem_offers()) { | 611 if (policy.has_allow_redeem_offers()) { |
| 610 new_values_cache->SetBoolean( | 612 new_values_cache->SetBoolean( |
| 611 kAllowRedeemChromeOsRegistrationOffers, | 613 kAllowRedeemChromeOsRegistrationOffers, |
| 612 policy.allow_redeem_offers().allow_redeem_offers()); | 614 policy.allow_redeem_offers().allow_redeem_offers()); |
| 613 } else { | 615 } else { |
| 614 new_values_cache->SetBoolean( | 616 new_values_cache->SetBoolean( |
| 615 kAllowRedeemChromeOsRegistrationOffers, | 617 kAllowRedeemChromeOsRegistrationOffers, |
| 616 !g_browser_process->browser_policy_connector()->IsEnterpriseManaged()); | 618 !g_browser_process->browser_policy_connector()->IsEnterpriseManaged()); |
| 617 } | 619 } |
| 620 |
| 621 new_values_cache->SetBoolean( |
| 622 kDeviceAttestationEnabled, |
| 623 policy.attestation_settings().attestation_enabled()); |
| 618 } | 624 } |
| 619 | 625 |
| 620 void DeviceSettingsProvider::UpdateValuesCache( | 626 void DeviceSettingsProvider::UpdateValuesCache( |
| 621 const em::PolicyData& policy_data, | 627 const em::PolicyData& policy_data, |
| 622 const em::ChromeDeviceSettingsProto& settings, | 628 const em::ChromeDeviceSettingsProto& settings, |
| 623 TrustedStatus trusted_status) { | 629 TrustedStatus trusted_status) { |
| 624 PrefValueMap new_values_cache; | 630 PrefValueMap new_values_cache; |
| 625 | 631 |
| 626 if (policy_data.has_username() && !policy_data.has_request_token()) | 632 if (policy_data.has_username() && !policy_data.has_request_token()) |
| 627 new_values_cache.SetString(kDeviceOwner, policy_data.username()); | 633 new_values_cache.SetString(kDeviceOwner, policy_data.username()); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 void DeviceSettingsProvider::AttemptMigration() { | 859 void DeviceSettingsProvider::AttemptMigration() { |
| 854 if (device_settings_service_->HasPrivateOwnerKey()) { | 860 if (device_settings_service_->HasPrivateOwnerKey()) { |
| 855 PrefValueMap::const_iterator i; | 861 PrefValueMap::const_iterator i; |
| 856 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 862 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
| 857 DoSet(i->first, *i->second); | 863 DoSet(i->first, *i->second); |
| 858 migration_values_.Clear(); | 864 migration_values_.Clear(); |
| 859 } | 865 } |
| 860 } | 866 } |
| 861 | 867 |
| 862 } // namespace chromeos | 868 } // namespace chromeos |
| OLD | NEW |