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/device_settings_provider.h" | 5 #include "chrome/browser/chromeos/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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 kAccountsPrefUsers, | 46 kAccountsPrefUsers, |
47 kAppPack, | 47 kAppPack, |
48 kDeviceOwner, | 48 kDeviceOwner, |
49 kIdleLogoutTimeout, | 49 kIdleLogoutTimeout, |
50 kIdleLogoutWarningDuration, | 50 kIdleLogoutWarningDuration, |
51 kPolicyMissingMitigationMode, | 51 kPolicyMissingMitigationMode, |
52 kReleaseChannel, | 52 kReleaseChannel, |
53 kReleaseChannelDelegated, | 53 kReleaseChannelDelegated, |
54 kReportDeviceActivityTimes, | 54 kReportDeviceActivityTimes, |
55 kReportDeviceBootMode, | 55 kReportDeviceBootMode, |
| 56 kReportDeviceLocation, |
56 kReportDeviceVersionInfo, | 57 kReportDeviceVersionInfo, |
57 kScreenSaverExtensionId, | 58 kScreenSaverExtensionId, |
58 kScreenSaverTimeout, | 59 kScreenSaverTimeout, |
59 kSettingProxyEverywhere, | 60 kSettingProxyEverywhere, |
60 kSignedDataRoamingEnabled, | 61 kSignedDataRoamingEnabled, |
61 kStartUpUrls, | 62 kStartUpUrls, |
62 kStatsReportingPref, | 63 kStatsReportingPref, |
63 }; | 64 }; |
64 | 65 |
65 // Upper bound for number of retries to fetch a signed setting. | 66 // Upper bound for number of retries to fetch a signed setting. |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 bool ephemeral_users_enabled_value = false; | 281 bool ephemeral_users_enabled_value = false; |
281 if (value->GetAsBoolean(&ephemeral_users_enabled_value)) | 282 if (value->GetAsBoolean(&ephemeral_users_enabled_value)) |
282 ephemeral_users_enabled->set_ephemeral_users_enabled( | 283 ephemeral_users_enabled->set_ephemeral_users_enabled( |
283 ephemeral_users_enabled_value); | 284 ephemeral_users_enabled_value); |
284 else | 285 else |
285 NOTREACHED(); | 286 NOTREACHED(); |
286 } else { | 287 } else { |
287 // The remaining settings don't support Set(), since they are not | 288 // The remaining settings don't support Set(), since they are not |
288 // intended to be customizable by the user: | 289 // intended to be customizable by the user: |
289 // kAppPack | 290 // kAppPack |
290 // kIdleLogoutTimeout, | 291 // kIdleLogoutTimeout |
291 // kIdleLogoutWarningDuration, | 292 // kIdleLogoutWarningDuration |
292 // kReleaseChannelDelegated, | 293 // kReleaseChannelDelegated |
293 // kReportDeviceVersionInfo | 294 // kReportDeviceVersionInfo |
294 // kReportDeviceActivityTimes | 295 // kReportDeviceActivityTimes |
295 // kReportDeviceBootMode | 296 // kReportDeviceBootMode |
296 // kScreenSaverExtensionId, | 297 // kReportDeviceLocation |
297 // kScreenSaverTimeout, | 298 // kScreenSaverExtensionId |
| 299 // kScreenSaverTimeout |
298 // kStartUpUrls | 300 // kStartUpUrls |
299 | 301 |
300 NOTREACHED(); | 302 NOTREACHED(); |
301 } | 303 } |
302 data.set_policy_value(pol.SerializeAsString()); | 304 data.set_policy_value(pol.SerializeAsString()); |
303 // Set the cache to the updated value. | 305 // Set the cache to the updated value. |
304 policy_ = data; | 306 policy_ = data; |
305 UpdateValuesCache(); | 307 UpdateValuesCache(); |
306 | 308 |
307 if (!signed_settings_cache::Store(data, g_browser_process->local_state())) | 309 if (!signed_settings_cache::Store(data, g_browser_process->local_state())) |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 if (policy.device_reporting().has_report_activity_times()) { | 485 if (policy.device_reporting().has_report_activity_times()) { |
484 new_values_cache->SetBoolean( | 486 new_values_cache->SetBoolean( |
485 kReportDeviceActivityTimes, | 487 kReportDeviceActivityTimes, |
486 policy.device_reporting().report_activity_times()); | 488 policy.device_reporting().report_activity_times()); |
487 } | 489 } |
488 if (policy.device_reporting().has_report_boot_mode()) { | 490 if (policy.device_reporting().has_report_boot_mode()) { |
489 new_values_cache->SetBoolean( | 491 new_values_cache->SetBoolean( |
490 kReportDeviceBootMode, | 492 kReportDeviceBootMode, |
491 policy.device_reporting().report_boot_mode()); | 493 policy.device_reporting().report_boot_mode()); |
492 } | 494 } |
| 495 if (policy.device_reporting().has_report_location()) { |
| 496 new_values_cache->SetBoolean( |
| 497 kReportDeviceLocation, |
| 498 policy.device_reporting().report_location()); |
| 499 } |
493 } | 500 } |
494 } | 501 } |
495 | 502 |
496 void DeviceSettingsProvider::DecodeGenericPolicies( | 503 void DeviceSettingsProvider::DecodeGenericPolicies( |
497 const em::ChromeDeviceSettingsProto& policy, | 504 const em::ChromeDeviceSettingsProto& policy, |
498 PrefValueMap* new_values_cache) const { | 505 PrefValueMap* new_values_cache) const { |
499 if (policy.has_metrics_enabled()) { | 506 if (policy.has_metrics_enabled()) { |
500 new_values_cache->SetBoolean(kStatsReportingPref, | 507 new_values_cache->SetBoolean(kStatsReportingPref, |
501 policy.metrics_enabled().metrics_enabled()); | 508 policy.metrics_enabled().metrics_enabled()); |
502 } else { | 509 } else { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 Reload(); | 734 Reload(); |
728 return; | 735 return; |
729 } | 736 } |
730 LOG(ERROR) << "No retries left"; | 737 LOG(ERROR) << "No retries left"; |
731 break; | 738 break; |
732 } | 739 } |
733 } | 740 } |
734 } | 741 } |
735 | 742 |
736 } // namespace chromeos | 743 } // namespace chromeos |
OLD | NEW |