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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 kAccountsPrefAllowGuest, | 42 kAccountsPrefAllowGuest, |
43 kAccountsPrefAllowNewUser, | 43 kAccountsPrefAllowNewUser, |
44 kAccountsPrefDeviceLocalAccounts, | 44 kAccountsPrefDeviceLocalAccounts, |
45 kAccountsPrefDeviceLocalAccountAutoLoginDelay, | 45 kAccountsPrefDeviceLocalAccountAutoLoginDelay, |
46 kAccountsPrefDeviceLocalAccountAutoLoginId, | 46 kAccountsPrefDeviceLocalAccountAutoLoginId, |
47 kAccountsPrefEphemeralUsersEnabled, | 47 kAccountsPrefEphemeralUsersEnabled, |
48 kAccountsPrefShowUserNamesOnSignIn, | 48 kAccountsPrefShowUserNamesOnSignIn, |
49 kAccountsPrefUsers, | 49 kAccountsPrefUsers, |
50 kAllowRedeemChromeOsRegistrationOffers, | 50 kAllowRedeemChromeOsRegistrationOffers, |
51 kAppPack, | 51 kAppPack, |
| 52 kDeviceAttestationEnabled, |
52 kDeviceOwner, | 53 kDeviceOwner, |
53 kIdleLogoutTimeout, | 54 kIdleLogoutTimeout, |
54 kIdleLogoutWarningDuration, | 55 kIdleLogoutWarningDuration, |
55 kPolicyMissingMitigationMode, | 56 kPolicyMissingMitigationMode, |
56 kReleaseChannel, | 57 kReleaseChannel, |
57 kReleaseChannelDelegated, | 58 kReleaseChannelDelegated, |
58 kReportDeviceActivityTimes, | 59 kReportDeviceActivityTimes, |
59 kReportDeviceBootMode, | 60 kReportDeviceBootMode, |
60 kReportDeviceLocation, | 61 kReportDeviceLocation, |
61 kReportDeviceVersionInfo, | 62 kReportDeviceVersionInfo, |
62 kScreenSaverExtensionId, | 63 kScreenSaverExtensionId, |
63 kScreenSaverTimeout, | 64 kScreenSaverTimeout, |
64 kSettingProxyEverywhere, | 65 kSettingProxyEverywhere, |
65 kSignedDataRoamingEnabled, | 66 kSignedDataRoamingEnabled, |
| 67 kStartUpFlags, |
66 kStartUpUrls, | 68 kStartUpUrls, |
67 kStatsReportingPref, | 69 kStatsReportingPref, |
68 kSystemTimezonePolicy, | 70 kSystemTimezonePolicy, |
69 kStartUpFlags, | |
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 | 613 |
612 if (policy.has_allow_redeem_offers()) { | 614 if (policy.has_allow_redeem_offers()) { |
613 new_values_cache->SetBoolean( | 615 new_values_cache->SetBoolean( |
614 kAllowRedeemChromeOsRegistrationOffers, | 616 kAllowRedeemChromeOsRegistrationOffers, |
615 policy.allow_redeem_offers().allow_redeem_offers()); | 617 policy.allow_redeem_offers().allow_redeem_offers()); |
616 } else { | 618 } else { |
617 new_values_cache->SetBoolean( | 619 new_values_cache->SetBoolean( |
618 kAllowRedeemChromeOsRegistrationOffers, | 620 kAllowRedeemChromeOsRegistrationOffers, |
619 !g_browser_process->browser_policy_connector()->IsEnterpriseManaged()); | 621 !g_browser_process->browser_policy_connector()->IsEnterpriseManaged()); |
620 } | 622 } |
| 623 |
| 624 new_values_cache->SetBoolean( |
| 625 kDeviceAttestationEnabled, |
| 626 policy.attestation_settings().attestation_enabled()); |
621 } | 627 } |
622 | 628 |
623 void DeviceSettingsProvider::UpdateValuesCache( | 629 void DeviceSettingsProvider::UpdateValuesCache( |
624 const em::PolicyData& policy_data, | 630 const em::PolicyData& policy_data, |
625 const em::ChromeDeviceSettingsProto& settings, | 631 const em::ChromeDeviceSettingsProto& settings, |
626 TrustedStatus trusted_status) { | 632 TrustedStatus trusted_status) { |
627 PrefValueMap new_values_cache; | 633 PrefValueMap new_values_cache; |
628 | 634 |
629 if (policy_data.has_username() && !policy_data.has_request_token()) | 635 if (policy_data.has_username() && !policy_data.has_request_token()) |
630 new_values_cache.SetString(kDeviceOwner, policy_data.username()); | 636 new_values_cache.SetString(kDeviceOwner, policy_data.username()); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 void DeviceSettingsProvider::AttemptMigration() { | 862 void DeviceSettingsProvider::AttemptMigration() { |
857 if (device_settings_service_->HasPrivateOwnerKey()) { | 863 if (device_settings_service_->HasPrivateOwnerKey()) { |
858 PrefValueMap::const_iterator i; | 864 PrefValueMap::const_iterator i; |
859 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 865 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
860 DoSet(i->first, *i->second); | 866 DoSet(i->first, *i->second); |
861 migration_values_.Clear(); | 867 migration_values_.Clear(); |
862 } | 868 } |
863 } | 869 } |
864 | 870 |
865 } // namespace chromeos | 871 } // namespace chromeos |
OLD | NEW |