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 27 matching lines...) Expand all Loading... | |
38 | 38 |
39 // List of settings handled by the DeviceSettingsProvider. | 39 // List of settings handled by the DeviceSettingsProvider. |
40 const char* kKnownSettings[] = { | 40 const char* kKnownSettings[] = { |
41 kAccountsPrefAllowGuest, | 41 kAccountsPrefAllowGuest, |
42 kAccountsPrefAllowNewUser, | 42 kAccountsPrefAllowNewUser, |
43 kAccountsPrefEphemeralUsersEnabled, | 43 kAccountsPrefEphemeralUsersEnabled, |
44 kAccountsPrefShowUserNamesOnSignIn, | 44 kAccountsPrefShowUserNamesOnSignIn, |
45 kAccountsPrefUsers, | 45 kAccountsPrefUsers, |
46 kAccountsPrefDeviceLocalAccounts, | 46 kAccountsPrefDeviceLocalAccounts, |
47 kAppPack, | 47 kAppPack, |
48 kChromeOsRegistrationEnabled, | |
48 kDeviceOwner, | 49 kDeviceOwner, |
49 kIdleLogoutTimeout, | 50 kIdleLogoutTimeout, |
50 kIdleLogoutWarningDuration, | 51 kIdleLogoutWarningDuration, |
51 kPolicyMissingMitigationMode, | 52 kPolicyMissingMitigationMode, |
52 kReleaseChannel, | 53 kReleaseChannel, |
53 kReleaseChannelDelegated, | 54 kReleaseChannelDelegated, |
54 kReportDeviceActivityTimes, | 55 kReportDeviceActivityTimes, |
55 kReportDeviceBootMode, | 56 kReportDeviceBootMode, |
56 kReportDeviceLocation, | 57 kReportDeviceLocation, |
57 kReportDeviceVersionInfo, | 58 kReportDeviceVersionInfo, |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 } else if (prop == kAccountsPrefEphemeralUsersEnabled) { | 284 } else if (prop == kAccountsPrefEphemeralUsersEnabled) { |
284 em::EphemeralUsersEnabledProto* ephemeral_users_enabled = | 285 em::EphemeralUsersEnabledProto* ephemeral_users_enabled = |
285 device_settings_.mutable_ephemeral_users_enabled(); | 286 device_settings_.mutable_ephemeral_users_enabled(); |
286 bool ephemeral_users_enabled_value = false; | 287 bool ephemeral_users_enabled_value = false; |
287 if (value->GetAsBoolean(&ephemeral_users_enabled_value)) { | 288 if (value->GetAsBoolean(&ephemeral_users_enabled_value)) { |
288 ephemeral_users_enabled->set_ephemeral_users_enabled( | 289 ephemeral_users_enabled->set_ephemeral_users_enabled( |
289 ephemeral_users_enabled_value); | 290 ephemeral_users_enabled_value); |
290 } else { | 291 } else { |
291 NOTREACHED(); | 292 NOTREACHED(); |
292 } | 293 } |
294 } else if (prop == kChromeOsRegistrationEnabled) { | |
295 em::ChromeOsRegistrationEnabledProto* cros_registration_enabled = | |
296 device_settings_.mutable_cros_registration_enabled(); | |
297 bool cros_registration_enabled_value = true; | |
298 if (value->GetAsBoolean(&cros_registration_enabled_value)) { | |
299 cros_registration_enabled->set_chrome_os_registration_enabled( | |
300 cros_registration_enabled_value); | |
301 } else { | |
302 NOTREACHED(); | |
303 } | |
293 } else { | 304 } else { |
294 // The remaining settings don't support Set(), since they are not | 305 // The remaining settings don't support Set(), since they are not |
295 // intended to be customizable by the user: | 306 // intended to be customizable by the user: |
296 // kAppPack | 307 // kAppPack |
297 // kDeviceOwner | 308 // kDeviceOwner |
298 // kIdleLogoutTimeout | 309 // kIdleLogoutTimeout |
299 // kIdleLogoutWarningDuration | 310 // kIdleLogoutWarningDuration |
300 // kReleaseChannelDelegated | 311 // kReleaseChannelDelegated |
301 // kReportDeviceVersionInfo | 312 // kReportDeviceVersionInfo |
302 // kReportDeviceActivityTimes | 313 // kReportDeviceActivityTimes |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 TrustedStatus trusted_status) { | 555 TrustedStatus trusted_status) { |
545 PrefValueMap new_values_cache; | 556 PrefValueMap new_values_cache; |
546 | 557 |
547 if (policy_data.has_username() && !policy_data.has_request_token()) | 558 if (policy_data.has_username() && !policy_data.has_request_token()) |
548 new_values_cache.SetString(kDeviceOwner, policy_data.username()); | 559 new_values_cache.SetString(kDeviceOwner, policy_data.username()); |
549 | 560 |
550 DecodeLoginPolicies(settings, &new_values_cache); | 561 DecodeLoginPolicies(settings, &new_values_cache); |
551 DecodeKioskPolicies(settings, &new_values_cache); | 562 DecodeKioskPolicies(settings, &new_values_cache); |
552 DecodeNetworkPolicies(settings, &new_values_cache); | 563 DecodeNetworkPolicies(settings, &new_values_cache); |
553 DecodeReportingPolicies(settings, &new_values_cache); | 564 DecodeReportingPolicies(settings, &new_values_cache); |
554 DecodeGenericPolicies(settings, &new_values_cache); | 565 DecodeGenericPolicies(settings, &new_values_cache); |
Mattias Nissler (ping if slow)
2013/02/04 09:06:19
You need to add some decoding, otherwise you'll ne
oscarpan
2013/02/05 00:17:47
Do you mean the decoder I added to "device_policy_
Mattias Nissler (ping if slow)
2013/02/05 13:06:53
No, that's a different beast which is only relevan
| |
555 | 566 |
556 // Collect all notifications but send them only after we have swapped the | 567 // Collect all notifications but send them only after we have swapped the |
557 // cache so that if somebody actually reads the cache will be already valid. | 568 // cache so that if somebody actually reads the cache will be already valid. |
558 std::vector<std::string> notifications; | 569 std::vector<std::string> notifications; |
559 // Go through the new values and verify in the old ones. | 570 // Go through the new values and verify in the old ones. |
560 PrefValueMap::iterator iter = new_values_cache.begin(); | 571 PrefValueMap::iterator iter = new_values_cache.begin(); |
561 for (; iter != new_values_cache.end(); ++iter) { | 572 for (; iter != new_values_cache.end(); ++iter) { |
562 const base::Value* old_value; | 573 const base::Value* old_value; |
563 if (!values_cache_.GetValue(iter->first, &old_value) || | 574 if (!values_cache_.GetValue(iter->first, &old_value) || |
564 !old_value->Equals(iter->second)) { | 575 !old_value->Equals(iter->second)) { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
773 void DeviceSettingsProvider::AttemptMigration() { | 784 void DeviceSettingsProvider::AttemptMigration() { |
774 if (device_settings_service_->HasPrivateOwnerKey()) { | 785 if (device_settings_service_->HasPrivateOwnerKey()) { |
775 PrefValueMap::const_iterator i; | 786 PrefValueMap::const_iterator i; |
776 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 787 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
777 DoSet(i->first, *i->second); | 788 DoSet(i->first, *i->second); |
778 migration_values_.Clear(); | 789 migration_values_.Clear(); |
779 } | 790 } |
780 } | 791 } |
781 | 792 |
782 } // namespace chromeos | 793 } // namespace chromeos |
OLD | NEW |