| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 kDeviceAttestationEnabled, | 55 kDeviceAttestationEnabled, |
| 56 kDeviceOwner, | 56 kDeviceOwner, |
| 57 kIdleLogoutTimeout, | 57 kIdleLogoutTimeout, |
| 58 kIdleLogoutWarningDuration, | 58 kIdleLogoutWarningDuration, |
| 59 kPolicyMissingMitigationMode, | 59 kPolicyMissingMitigationMode, |
| 60 kReleaseChannel, | 60 kReleaseChannel, |
| 61 kReleaseChannelDelegated, | 61 kReleaseChannelDelegated, |
| 62 kReportDeviceActivityTimes, | 62 kReportDeviceActivityTimes, |
| 63 kReportDeviceBootMode, | 63 kReportDeviceBootMode, |
| 64 kReportDeviceLocation, | 64 kReportDeviceLocation, |
| 65 kReportDeviceNetworkInterfaces, |
| 65 kReportDeviceVersionInfo, | 66 kReportDeviceVersionInfo, |
| 66 kScreenSaverExtensionId, | 67 kScreenSaverExtensionId, |
| 67 kScreenSaverTimeout, | 68 kScreenSaverTimeout, |
| 68 kSignedDataRoamingEnabled, | 69 kSignedDataRoamingEnabled, |
| 69 kStartUpFlags, | 70 kStartUpFlags, |
| 70 kStartUpUrls, | 71 kStartUpUrls, |
| 71 kStatsReportingPref, | 72 kStatsReportingPref, |
| 72 kSystemTimezonePolicy, | 73 kSystemTimezonePolicy, |
| 73 kUpdateDisabled, | 74 kUpdateDisabled, |
| 74 kVariationsRestrictParameter, | 75 kVariationsRestrictParameter, |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // kAppPack | 372 // kAppPack |
| 372 // kDeviceAttestationEnabled | 373 // kDeviceAttestationEnabled |
| 373 // kDeviceOwner | 374 // kDeviceOwner |
| 374 // kIdleLogoutTimeout | 375 // kIdleLogoutTimeout |
| 375 // kIdleLogoutWarningDuration | 376 // kIdleLogoutWarningDuration |
| 376 // kReleaseChannelDelegated | 377 // kReleaseChannelDelegated |
| 377 // kReportDeviceActivityTimes | 378 // kReportDeviceActivityTimes |
| 378 // kReportDeviceBootMode | 379 // kReportDeviceBootMode |
| 379 // kReportDeviceLocation | 380 // kReportDeviceLocation |
| 380 // kReportDeviceVersionInfo | 381 // kReportDeviceVersionInfo |
| 382 // kReportDeviceNetworkInterfaces |
| 381 // kScreenSaverExtensionId | 383 // kScreenSaverExtensionId |
| 382 // kScreenSaverTimeout | 384 // kScreenSaverTimeout |
| 383 // kStartUpUrls | 385 // kStartUpUrls |
| 384 // kSystemTimezonePolicy | 386 // kSystemTimezonePolicy |
| 385 // kVariationsRestrictParameter | 387 // kVariationsRestrictParameter |
| 386 | 388 |
| 387 LOG(FATAL) << "Device setting " << prop << " is read-only."; | 389 LOG(FATAL) << "Device setting " << prop << " is read-only."; |
| 388 } | 390 } |
| 389 | 391 |
| 390 em::PolicyData data; | 392 em::PolicyData data; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 new_values_cache->SetBoolean( | 607 new_values_cache->SetBoolean( |
| 606 kSignedDataRoamingEnabled, | 608 kSignedDataRoamingEnabled, |
| 607 policy.has_data_roaming_enabled() && | 609 policy.has_data_roaming_enabled() && |
| 608 policy.data_roaming_enabled().has_data_roaming_enabled() && | 610 policy.data_roaming_enabled().has_data_roaming_enabled() && |
| 609 policy.data_roaming_enabled().data_roaming_enabled()); | 611 policy.data_roaming_enabled().data_roaming_enabled()); |
| 610 } | 612 } |
| 611 | 613 |
| 612 void DeviceSettingsProvider::DecodeAutoUpdatePolicies( | 614 void DeviceSettingsProvider::DecodeAutoUpdatePolicies( |
| 613 const em::ChromeDeviceSettingsProto& policy, | 615 const em::ChromeDeviceSettingsProto& policy, |
| 614 PrefValueMap* new_values_cache) const { | 616 PrefValueMap* new_values_cache) const { |
| 615 if (!policy.has_auto_update_settings()) | 617 if (policy.has_auto_update_settings()) { |
| 616 return; | 618 const em::AutoUpdateSettingsProto& au_settings_proto = |
| 617 const em::AutoUpdateSettingsProto& au_settings_proto = | 619 policy.auto_update_settings(); |
| 618 policy.auto_update_settings(); | 620 if (au_settings_proto.has_update_disabled()) { |
| 619 if (au_settings_proto.has_update_disabled()) { | 621 new_values_cache->SetBoolean(kUpdateDisabled, |
| 620 new_values_cache->SetBoolean(kUpdateDisabled, | 622 au_settings_proto.update_disabled()); |
| 621 au_settings_proto.update_disabled()); | 623 } |
| 624 const RepeatedField<int>& allowed_connection_types = |
| 625 au_settings_proto.allowed_connection_types(); |
| 626 base::ListValue* list = new base::ListValue(); |
| 627 for (RepeatedField<int>::const_iterator i(allowed_connection_types.begin()); |
| 628 i != allowed_connection_types.end(); ++i) { |
| 629 list->Append(new base::FundamentalValue(*i)); |
| 630 } |
| 631 new_values_cache->SetValue(kAllowedConnectionTypesForUpdate, list); |
| 622 } | 632 } |
| 623 const RepeatedField<int>& allowed_connection_types = | |
| 624 au_settings_proto.allowed_connection_types(); | |
| 625 base::ListValue* list = new base::ListValue(); | |
| 626 for (RepeatedField<int>::const_iterator i = allowed_connection_types.begin(), | |
| 627 e = allowed_connection_types.end(); i != e; ++i) { | |
| 628 list->Append(new base::FundamentalValue(*i)); | |
| 629 } | |
| 630 new_values_cache->SetValue(kAllowedConnectionTypesForUpdate, list); | |
| 631 } | 633 } |
| 632 | 634 |
| 633 void DeviceSettingsProvider::DecodeReportingPolicies( | 635 void DeviceSettingsProvider::DecodeReportingPolicies( |
| 634 const em::ChromeDeviceSettingsProto& policy, | 636 const em::ChromeDeviceSettingsProto& policy, |
| 635 PrefValueMap* new_values_cache) const { | 637 PrefValueMap* new_values_cache) const { |
| 636 if (policy.has_device_reporting()) { | 638 if (policy.has_device_reporting()) { |
| 637 if (policy.device_reporting().has_report_version_info()) { | 639 const em::DeviceReportingProto& reporting_policy = |
| 640 policy.device_reporting(); |
| 641 if (reporting_policy.has_report_version_info()) { |
| 638 new_values_cache->SetBoolean( | 642 new_values_cache->SetBoolean( |
| 639 kReportDeviceVersionInfo, | 643 kReportDeviceVersionInfo, |
| 640 policy.device_reporting().report_version_info()); | 644 reporting_policy.report_version_info()); |
| 641 } | 645 } |
| 642 if (policy.device_reporting().has_report_activity_times()) { | 646 if (reporting_policy.has_report_activity_times()) { |
| 643 new_values_cache->SetBoolean( | 647 new_values_cache->SetBoolean( |
| 644 kReportDeviceActivityTimes, | 648 kReportDeviceActivityTimes, |
| 645 policy.device_reporting().report_activity_times()); | 649 reporting_policy.report_activity_times()); |
| 646 } | 650 } |
| 647 if (policy.device_reporting().has_report_boot_mode()) { | 651 if (reporting_policy.has_report_boot_mode()) { |
| 648 new_values_cache->SetBoolean( | 652 new_values_cache->SetBoolean( |
| 649 kReportDeviceBootMode, | 653 kReportDeviceBootMode, |
| 650 policy.device_reporting().report_boot_mode()); | 654 reporting_policy.report_boot_mode()); |
| 651 } | 655 } |
| 652 // Device location reporting needs to pass privacy review before it can be | 656 if (reporting_policy.has_report_network_interfaces()) { |
| 653 // enabled. crosbug.com/24681 | 657 new_values_cache->SetBoolean( |
| 654 // if (policy.device_reporting().has_report_location()) { | 658 kReportDeviceNetworkInterfaces, |
| 655 // new_values_cache->SetBoolean( | 659 reporting_policy.report_network_interfaces()); |
| 656 // kReportDeviceLocation, | 660 } |
| 657 // policy.device_reporting().report_location()); | |
| 658 // } | |
| 659 } | 661 } |
| 660 } | 662 } |
| 661 | 663 |
| 662 void DeviceSettingsProvider::DecodeGenericPolicies( | 664 void DeviceSettingsProvider::DecodeGenericPolicies( |
| 663 const em::ChromeDeviceSettingsProto& policy, | 665 const em::ChromeDeviceSettingsProto& policy, |
| 664 PrefValueMap* new_values_cache) const { | 666 PrefValueMap* new_values_cache) const { |
| 665 if (policy.has_metrics_enabled()) { | 667 if (policy.has_metrics_enabled()) { |
| 666 new_values_cache->SetBoolean(kStatsReportingPref, | 668 new_values_cache->SetBoolean(kStatsReportingPref, |
| 667 policy.metrics_enabled().metrics_enabled()); | 669 policy.metrics_enabled().metrics_enabled()); |
| 668 } else { | 670 } else { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 void DeviceSettingsProvider::AttemptMigration() { | 954 void DeviceSettingsProvider::AttemptMigration() { |
| 953 if (device_settings_service_->HasPrivateOwnerKey()) { | 955 if (device_settings_service_->HasPrivateOwnerKey()) { |
| 954 PrefValueMap::const_iterator i; | 956 PrefValueMap::const_iterator i; |
| 955 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 957 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
| 956 DoSet(i->first, *i->second); | 958 DoSet(i->first, *i->second); |
| 957 migration_values_.Clear(); | 959 migration_values_.Clear(); |
| 958 } | 960 } |
| 959 } | 961 } |
| 960 | 962 |
| 961 } // namespace chromeos | 963 } // namespace chromeos |
| OLD | NEW |