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 29 matching lines...) Expand all Loading... |
40 // List of settings handled by the DeviceSettingsProvider. | 40 // List of settings handled by the DeviceSettingsProvider. |
41 const char* kKnownSettings[] = { | 41 const char* kKnownSettings[] = { |
42 kAccountsPrefAllowGuest, | 42 kAccountsPrefAllowGuest, |
43 kAccountsPrefAllowNewUser, | 43 kAccountsPrefAllowNewUser, |
44 kAccountsPrefDeviceLocalAccounts, | 44 kAccountsPrefDeviceLocalAccounts, |
45 kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled, | 45 kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled, |
46 kAccountsPrefDeviceLocalAccountAutoLoginDelay, | 46 kAccountsPrefDeviceLocalAccountAutoLoginDelay, |
47 kAccountsPrefDeviceLocalAccountAutoLoginId, | 47 kAccountsPrefDeviceLocalAccountAutoLoginId, |
48 kAccountsPrefEphemeralUsersEnabled, | 48 kAccountsPrefEphemeralUsersEnabled, |
49 kAccountsPrefShowUserNamesOnSignIn, | 49 kAccountsPrefShowUserNamesOnSignIn, |
| 50 kAccountsPrefSupervisedUsersEnabled, |
50 kAccountsPrefUsers, | 51 kAccountsPrefUsers, |
51 kAllowRedeemChromeOsRegistrationOffers, | 52 kAllowRedeemChromeOsRegistrationOffers, |
52 kAllowedConnectionTypesForUpdate, | 53 kAllowedConnectionTypesForUpdate, |
53 kAppPack, | 54 kAppPack, |
54 kDeviceAttestationEnabled, | 55 kDeviceAttestationEnabled, |
55 kDeviceOwner, | 56 kDeviceOwner, |
56 kIdleLogoutTimeout, | 57 kIdleLogoutTimeout, |
57 kIdleLogoutWarningDuration, | 58 kIdleLogoutWarningDuration, |
58 kPolicyMissingMitigationMode, | 59 kPolicyMissingMitigationMode, |
59 kReleaseChannel, | 60 kReleaseChannel, |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 for (base::ListValue::const_iterator i = flags->begin(); | 360 for (base::ListValue::const_iterator i = flags->begin(); |
360 i != flags->end(); ++i) { | 361 i != flags->end(); ++i) { |
361 std::string flag; | 362 std::string flag; |
362 if ((*i)->GetAsString(&flag)) | 363 if ((*i)->GetAsString(&flag)) |
363 flags_proto->add_flags(flag); | 364 flags_proto->add_flags(flag); |
364 } | 365 } |
365 } | 366 } |
366 } else { | 367 } else { |
367 // The remaining settings don't support Set(), since they are not | 368 // The remaining settings don't support Set(), since they are not |
368 // intended to be customizable by the user: | 369 // intended to be customizable by the user: |
| 370 // kAccountsPrefSupervisedUsersEnabled |
369 // kAppPack | 371 // kAppPack |
370 // kDeviceAttestationEnabled | 372 // kDeviceAttestationEnabled |
371 // kDeviceOwner | 373 // kDeviceOwner |
372 // kIdleLogoutTimeout | 374 // kIdleLogoutTimeout |
373 // kIdleLogoutWarningDuration | 375 // kIdleLogoutWarningDuration |
374 // kReleaseChannelDelegated | 376 // kReleaseChannelDelegated |
375 // kReportDeviceVersionInfo | |
376 // kReportDeviceActivityTimes | 377 // kReportDeviceActivityTimes |
377 // kReportDeviceBootMode | 378 // kReportDeviceBootMode |
378 // kReportDeviceLocation | 379 // kReportDeviceLocation |
| 380 // kReportDeviceVersionInfo |
379 // kScreenSaverExtensionId | 381 // kScreenSaverExtensionId |
380 // kScreenSaverTimeout | 382 // kScreenSaverTimeout |
381 // kStartUpUrls | 383 // kStartUpUrls |
382 // kSystemTimezonePolicy | 384 // kSystemTimezonePolicy |
383 // kVariationsRestrictParameter | 385 // kVariationsRestrictParameter |
384 | 386 |
385 LOG(FATAL) << "Device setting " << prop << " is read-only."; | 387 LOG(FATAL) << "Device setting " << prop << " is read-only."; |
386 } | 388 } |
387 | 389 |
388 em::PolicyData data; | 390 em::PolicyData data; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 !policy.has_show_user_names() || | 443 !policy.has_show_user_names() || |
442 !policy.show_user_names().has_show_user_names() || | 444 !policy.show_user_names().has_show_user_names() || |
443 policy.show_user_names().show_user_names()); | 445 policy.show_user_names().show_user_names()); |
444 | 446 |
445 new_values_cache->SetBoolean( | 447 new_values_cache->SetBoolean( |
446 kAccountsPrefEphemeralUsersEnabled, | 448 kAccountsPrefEphemeralUsersEnabled, |
447 policy.has_ephemeral_users_enabled() && | 449 policy.has_ephemeral_users_enabled() && |
448 policy.ephemeral_users_enabled().has_ephemeral_users_enabled() && | 450 policy.ephemeral_users_enabled().has_ephemeral_users_enabled() && |
449 policy.ephemeral_users_enabled().ephemeral_users_enabled()); | 451 policy.ephemeral_users_enabled().ephemeral_users_enabled()); |
450 | 452 |
| 453 new_values_cache->SetBoolean( |
| 454 kAccountsPrefSupervisedUsersEnabled, |
| 455 policy.has_supervised_users_settings() && |
| 456 policy.supervised_users_settings().supervised_users_enabled()); |
| 457 |
451 base::ListValue* list = new base::ListValue(); | 458 base::ListValue* list = new base::ListValue(); |
452 const em::UserWhitelistProto& whitelist_proto = policy.user_whitelist(); | 459 const em::UserWhitelistProto& whitelist_proto = policy.user_whitelist(); |
453 const RepeatedPtrField<std::string>& whitelist = | 460 const RepeatedPtrField<std::string>& whitelist = |
454 whitelist_proto.user_whitelist(); | 461 whitelist_proto.user_whitelist(); |
455 for (RepeatedPtrField<std::string>::const_iterator it = whitelist.begin(); | 462 for (RepeatedPtrField<std::string>::const_iterator it = whitelist.begin(); |
456 it != whitelist.end(); ++it) { | 463 it != whitelist.end(); ++it) { |
457 list->Append(new base::StringValue(*it)); | 464 list->Append(new base::StringValue(*it)); |
458 } | 465 } |
459 new_values_cache->SetValue(kAccountsPrefUsers, list); | 466 new_values_cache->SetValue(kAccountsPrefUsers, list); |
460 | 467 |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 void DeviceSettingsProvider::AttemptMigration() { | 952 void DeviceSettingsProvider::AttemptMigration() { |
946 if (device_settings_service_->HasPrivateOwnerKey()) { | 953 if (device_settings_service_->HasPrivateOwnerKey()) { |
947 PrefValueMap::const_iterator i; | 954 PrefValueMap::const_iterator i; |
948 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 955 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
949 DoSet(i->first, *i->second); | 956 DoSet(i->first, *i->second); |
950 migration_values_.Clear(); | 957 migration_values_.Clear(); |
951 } | 958 } |
952 } | 959 } |
953 | 960 |
954 } // namespace chromeos | 961 } // namespace chromeos |
OLD | NEW |