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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 kAccountsPrefSupervisedUsersEnabled, | 49 kAccountsPrefSupervisedUsersEnabled, |
50 kAccountsPrefUsers, | 50 kAccountsPrefUsers, |
51 kAllowRedeemChromeOsRegistrationOffers, | 51 kAllowRedeemChromeOsRegistrationOffers, |
52 kAllowedConnectionTypesForUpdate, | 52 kAllowedConnectionTypesForUpdate, |
53 kAppPack, | 53 kAppPack, |
54 kAttestationForContentProtectionEnabled, | 54 kAttestationForContentProtectionEnabled, |
55 kDeviceAttestationEnabled, | 55 kDeviceAttestationEnabled, |
56 kDeviceOwner, | 56 kDeviceOwner, |
57 kIdleLogoutTimeout, | 57 kIdleLogoutTimeout, |
58 kIdleLogoutWarningDuration, | 58 kIdleLogoutWarningDuration, |
| 59 kKioskVirtualKeyboardLayout, |
59 kPolicyMissingMitigationMode, | 60 kPolicyMissingMitigationMode, |
60 kReleaseChannel, | 61 kReleaseChannel, |
61 kReleaseChannelDelegated, | 62 kReleaseChannelDelegated, |
62 kReportDeviceActivityTimes, | 63 kReportDeviceActivityTimes, |
63 kReportDeviceBootMode, | 64 kReportDeviceBootMode, |
64 kReportDeviceLocation, | 65 kReportDeviceLocation, |
65 kReportDeviceNetworkInterfaces, | 66 kReportDeviceNetworkInterfaces, |
66 kReportDeviceUsers, | 67 kReportDeviceUsers, |
67 kReportDeviceVersionInfo, | 68 kReportDeviceVersionInfo, |
68 kScreenSaverExtensionId, | 69 kScreenSaverExtensionId, |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 } | 388 } |
388 } else if (prop == kAttestationForContentProtectionEnabled) { | 389 } else if (prop == kAttestationForContentProtectionEnabled) { |
389 em::AttestationSettingsProto* attestation_settings = | 390 em::AttestationSettingsProto* attestation_settings = |
390 device_settings_.mutable_attestation_settings(); | 391 device_settings_.mutable_attestation_settings(); |
391 bool setting_enabled; | 392 bool setting_enabled; |
392 if (value->GetAsBoolean(&setting_enabled)) { | 393 if (value->GetAsBoolean(&setting_enabled)) { |
393 attestation_settings->set_content_protection_enabled(setting_enabled); | 394 attestation_settings->set_content_protection_enabled(setting_enabled); |
394 } else { | 395 } else { |
395 NOTREACHED(); | 396 NOTREACHED(); |
396 } | 397 } |
| 398 } else if (prop == kKioskVirtualKeyboardLayout) { |
| 399 em::KioskVirtualKeyboardProto* keyboard_settings = |
| 400 device_settings_.mutable_kiosk_virtual_keyboard(); |
| 401 std::string layout; |
| 402 if (value->GetAsString(&layout)) |
| 403 keyboard_settings->set_layout(layout); |
| 404 else |
| 405 NOTREACHED(); |
397 } else { | 406 } else { |
398 // The remaining settings don't support Set(), since they are not | 407 // The remaining settings don't support Set(), since they are not |
399 // intended to be customizable by the user: | 408 // intended to be customizable by the user: |
400 // kAppPack | 409 // kAppPack |
401 // kDeviceAttestationEnabled | 410 // kDeviceAttestationEnabled |
402 // kDeviceOwner | 411 // kDeviceOwner |
403 // kIdleLogoutTimeout | 412 // kIdleLogoutTimeout |
404 // kIdleLogoutWarningDuration | 413 // kIdleLogoutWarningDuration |
405 // kReleaseChannelDelegated | 414 // kReleaseChannelDelegated |
406 // kReportDeviceActivityTimes | 415 // kReportDeviceActivityTimes |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 policy.attestation_settings().attestation_enabled()); | 775 policy.attestation_settings().attestation_enabled()); |
767 | 776 |
768 if (policy.has_attestation_settings() && | 777 if (policy.has_attestation_settings() && |
769 policy.attestation_settings().has_content_protection_enabled()) { | 778 policy.attestation_settings().has_content_protection_enabled()) { |
770 new_values_cache->SetBoolean( | 779 new_values_cache->SetBoolean( |
771 kAttestationForContentProtectionEnabled, | 780 kAttestationForContentProtectionEnabled, |
772 policy.attestation_settings().content_protection_enabled()); | 781 policy.attestation_settings().content_protection_enabled()); |
773 } else { | 782 } else { |
774 new_values_cache->SetBoolean(kAttestationForContentProtectionEnabled, true); | 783 new_values_cache->SetBoolean(kAttestationForContentProtectionEnabled, true); |
775 } | 784 } |
| 785 |
| 786 if (policy.has_kiosk_virtual_keyboard() && |
| 787 policy.kiosk_virtual_keyboard().has_layout()) { |
| 788 new_values_cache->SetString( |
| 789 kKioskVirtualKeyboardLayout, |
| 790 policy.kiosk_virtual_keyboard().layout()); |
| 791 } |
776 } | 792 } |
777 | 793 |
778 void DeviceSettingsProvider::UpdateValuesCache( | 794 void DeviceSettingsProvider::UpdateValuesCache( |
779 const em::PolicyData& policy_data, | 795 const em::PolicyData& policy_data, |
780 const em::ChromeDeviceSettingsProto& settings, | 796 const em::ChromeDeviceSettingsProto& settings, |
781 TrustedStatus trusted_status) { | 797 TrustedStatus trusted_status) { |
782 PrefValueMap new_values_cache; | 798 PrefValueMap new_values_cache; |
783 | 799 |
784 if (policy_data.has_username() && !policy_data.has_request_token()) | 800 if (policy_data.has_username() && !policy_data.has_request_token()) |
785 new_values_cache.SetString(kDeviceOwner, policy_data.username()); | 801 new_values_cache.SetString(kDeviceOwner, policy_data.username()); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 void DeviceSettingsProvider::AttemptMigration() { | 1012 void DeviceSettingsProvider::AttemptMigration() { |
997 if (device_settings_service_->HasPrivateOwnerKey()) { | 1013 if (device_settings_service_->HasPrivateOwnerKey()) { |
998 PrefValueMap::const_iterator i; | 1014 PrefValueMap::const_iterator i; |
999 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 1015 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
1000 DoSet(i->first, *i->second); | 1016 DoSet(i->first, *i->second); |
1001 migration_values_.Clear(); | 1017 migration_values_.Clear(); |
1002 } | 1018 } |
1003 } | 1019 } |
1004 | 1020 |
1005 } // namespace chromeos | 1021 } // namespace chromeos |
OLD | NEW |