Chromium Code Reviews| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 kStartUpFlags, | 75 kStartUpFlags, |
| 76 kStatsReportingPref, | 76 kStatsReportingPref, |
| 77 kSystemTimezonePolicy, | 77 kSystemTimezonePolicy, |
| 78 kSystemUse24HourClock, | 78 kSystemUse24HourClock, |
| 79 kUpdateDisabled, | 79 kUpdateDisabled, |
| 80 kVariationsRestrictParameter, | 80 kVariationsRestrictParameter, |
| 81 kDeviceDisabled, | 81 kDeviceDisabled, |
| 82 kDeviceDisabledMessage, | 82 kDeviceDisabledMessage, |
| 83 kRebootOnShutdown, | 83 kRebootOnShutdown, |
| 84 kExtensionCacheSize, | 84 kExtensionCacheSize, |
| 85 kDeviceLoginScreenDomainAutoComplete, | |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 bool HasOldMetricsFile() { | 88 bool HasOldMetricsFile() { |
| 88 // TODO(pastarmovj): Remove this once migration is not needed anymore. | 89 // TODO(pastarmovj): Remove this once migration is not needed anymore. |
| 89 // If the value is not set we should try to migrate legacy consent file. | 90 // If the value is not set we should try to migrate legacy consent file. |
| 90 // Loading consent file state causes us to do blocking IO on UI thread. | 91 // Loading consent file state causes us to do blocking IO on UI thread. |
| 91 // Temporarily allow it until we fix http://crbug.com/62626 | 92 // Temporarily allow it until we fix http://crbug.com/62626 |
| 92 base::ThreadRestrictions::ScopedAllowIO allow_io; | 93 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 93 return GoogleUpdateSettings::GetCollectStatsConsent(); | 94 return GoogleUpdateSettings::GetCollectStatsConsent(); |
| 94 } | 95 } |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 } else { | 418 } else { |
| 418 new_values_cache->SetBoolean(kAttestationForContentProtectionEnabled, true); | 419 new_values_cache->SetBoolean(kAttestationForContentProtectionEnabled, true); |
| 419 } | 420 } |
| 420 | 421 |
| 421 if (policy.has_extension_cache_size() && | 422 if (policy.has_extension_cache_size() && |
| 422 policy.extension_cache_size().has_extension_cache_size()) { | 423 policy.extension_cache_size().has_extension_cache_size()) { |
| 423 new_values_cache->SetInteger( | 424 new_values_cache->SetInteger( |
| 424 kExtensionCacheSize, | 425 kExtensionCacheSize, |
| 425 policy.extension_cache_size().extension_cache_size()); | 426 policy.extension_cache_size().extension_cache_size()); |
| 426 } | 427 } |
| 428 | |
| 429 // The behavior when policy is not set and when it is set to an empty string | |
| 430 // is the same. Thus lets add policy only if it is set and its value is not | |
| 431 // an empty string. | |
| 432 if (policy.has_login_screen_domain_auto_complete() && | |
| 433 policy.has_login_screen_domain_auto_complete() | |
|
Andrew T Wilson (Slow)
2015/04/01 13:33:21
This doesn't look like it compiles. I wonder if we
peletskyi
2015/04/01 13:55:19
I've fixed this. About names - I just follow the c
| |
| 434 .has_login_screen_domain_auto_complete() && | |
| 435 !policy.login_screen_domain_auto_complete().empty()) { | |
| 436 new_values_cache->SetString(kDeviceLoginScreenDomainAutoComplete, | |
| 437 policy.login_screen_domain_auto_complete() | |
| 438 .login_screen_domain_auto_complete()); | |
| 439 } | |
| 427 } | 440 } |
| 428 | 441 |
| 429 void DecodeDeviceState(const em::PolicyData& policy_data, | 442 void DecodeDeviceState(const em::PolicyData& policy_data, |
| 430 PrefValueMap* new_values_cache) { | 443 PrefValueMap* new_values_cache) { |
| 431 if (!policy_data.has_device_state()) | 444 if (!policy_data.has_device_state()) |
| 432 return; | 445 return; |
| 433 | 446 |
| 434 const em::DeviceState& device_state = policy_data.device_state(); | 447 const em::DeviceState& device_state = policy_data.device_state(); |
| 435 | 448 |
| 436 if (device_state.device_mode() == em::DeviceState::DEVICE_MODE_DISABLED) | 449 if (device_state.device_mode() == em::DeviceState::DEVICE_MODE_DISABLED) |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 804 void DeviceSettingsProvider::AttemptMigration() { | 817 void DeviceSettingsProvider::AttemptMigration() { |
| 805 if (device_settings_service_->HasPrivateOwnerKey()) { | 818 if (device_settings_service_->HasPrivateOwnerKey()) { |
| 806 PrefValueMap::const_iterator i; | 819 PrefValueMap::const_iterator i; |
| 807 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 820 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
| 808 DoSet(i->first, *i->second); | 821 DoSet(i->first, *i->second); |
| 809 migration_values_.Clear(); | 822 migration_values_.Clear(); |
| 810 } | 823 } |
| 811 } | 824 } |
| 812 | 825 |
| 813 } // namespace chromeos | 826 } // namespace chromeos |
| OLD | NEW |