| 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 kVariationsRestrictParameter, | 71 kVariationsRestrictParameter, |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 // Legacy policy file location. Used to detect migration from pre v12 ChromeOS. | 74 // Legacy policy file location. Used to detect migration from pre v12 ChromeOS. |
| 74 const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences"; | 75 const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences"; |
| 75 | 76 |
| 76 bool HasOldMetricsFile() { | 77 bool HasOldMetricsFile() { |
| 77 // TODO(pastarmovj): Remove this once migration is not needed anymore. | 78 // TODO(pastarmovj): Remove this once migration is not needed anymore. |
| 78 // If the value is not set we should try to migrate legacy consent file. | 79 // If the value is not set we should try to migrate legacy consent file. |
| 79 // Loading consent file state causes us to do blocking IO on UI thread. | 80 // Loading consent file state causes us to do blocking IO on UI thread. |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 i != flags->end(); ++i) { | 335 i != flags->end(); ++i) { |
| 335 std::string flag; | 336 std::string flag; |
| 336 if ((*i)->GetAsString(&flag)) | 337 if ((*i)->GetAsString(&flag)) |
| 337 flags_proto->add_flags(flag); | 338 flags_proto->add_flags(flag); |
| 338 } | 339 } |
| 339 } | 340 } |
| 340 } else { | 341 } else { |
| 341 // The remaining settings don't support Set(), since they are not | 342 // The remaining settings don't support Set(), since they are not |
| 342 // intended to be customizable by the user: | 343 // intended to be customizable by the user: |
| 343 // kAppPack | 344 // kAppPack |
| 345 // kDeviceAttestationEnabled |
| 344 // kDeviceOwner | 346 // kDeviceOwner |
| 345 // kIdleLogoutTimeout | 347 // kIdleLogoutTimeout |
| 346 // kIdleLogoutWarningDuration | 348 // kIdleLogoutWarningDuration |
| 347 // kReleaseChannelDelegated | 349 // kReleaseChannelDelegated |
| 348 // kReportDeviceVersionInfo | 350 // kReportDeviceVersionInfo |
| 349 // kReportDeviceActivityTimes | 351 // kReportDeviceActivityTimes |
| 350 // kReportDeviceBootMode | 352 // kReportDeviceBootMode |
| 351 // kReportDeviceLocation | 353 // kReportDeviceLocation |
| 352 // kScreenSaverExtensionId | 354 // kScreenSaverExtensionId |
| 353 // kScreenSaverTimeout | 355 // kScreenSaverTimeout |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 new_values_cache->SetBoolean( | 621 new_values_cache->SetBoolean( |
| 620 kAllowRedeemChromeOsRegistrationOffers, | 622 kAllowRedeemChromeOsRegistrationOffers, |
| 621 !g_browser_process->browser_policy_connector()->IsEnterpriseManaged()); | 623 !g_browser_process->browser_policy_connector()->IsEnterpriseManaged()); |
| 622 } | 624 } |
| 623 | 625 |
| 624 if (policy.has_variations_parameter()) { | 626 if (policy.has_variations_parameter()) { |
| 625 new_values_cache->SetString( | 627 new_values_cache->SetString( |
| 626 kVariationsRestrictParameter, | 628 kVariationsRestrictParameter, |
| 627 policy.variations_parameter().parameter()); | 629 policy.variations_parameter().parameter()); |
| 628 } | 630 } |
| 631 |
| 632 new_values_cache->SetBoolean( |
| 633 kDeviceAttestationEnabled, |
| 634 policy.attestation_settings().attestation_enabled()); |
| 629 } | 635 } |
| 630 | 636 |
| 631 void DeviceSettingsProvider::UpdateValuesCache( | 637 void DeviceSettingsProvider::UpdateValuesCache( |
| 632 const em::PolicyData& policy_data, | 638 const em::PolicyData& policy_data, |
| 633 const em::ChromeDeviceSettingsProto& settings, | 639 const em::ChromeDeviceSettingsProto& settings, |
| 634 TrustedStatus trusted_status) { | 640 TrustedStatus trusted_status) { |
| 635 PrefValueMap new_values_cache; | 641 PrefValueMap new_values_cache; |
| 636 | 642 |
| 637 if (policy_data.has_username() && !policy_data.has_request_token()) | 643 if (policy_data.has_username() && !policy_data.has_request_token()) |
| 638 new_values_cache.SetString(kDeviceOwner, policy_data.username()); | 644 new_values_cache.SetString(kDeviceOwner, policy_data.username()); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 void DeviceSettingsProvider::AttemptMigration() { | 872 void DeviceSettingsProvider::AttemptMigration() { |
| 867 if (device_settings_service_->HasPrivateOwnerKey()) { | 873 if (device_settings_service_->HasPrivateOwnerKey()) { |
| 868 PrefValueMap::const_iterator i; | 874 PrefValueMap::const_iterator i; |
| 869 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 875 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
| 870 DoSet(i->first, *i->second); | 876 DoSet(i->first, *i->second); |
| 871 migration_values_.Clear(); | 877 migration_values_.Clear(); |
| 872 } | 878 } |
| 873 } | 879 } |
| 874 | 880 |
| 875 } // namespace chromeos | 881 } // namespace chromeos |
| OLD | NEW |