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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 kIdleLogoutWarningDuration, | 48 kIdleLogoutWarningDuration, |
49 kReleaseChannel, | 49 kReleaseChannel, |
50 kReleaseChannelDelegated, | 50 kReleaseChannelDelegated, |
51 kReportDeviceActivityTimes, | 51 kReportDeviceActivityTimes, |
52 kReportDeviceBootMode, | 52 kReportDeviceBootMode, |
53 kReportDeviceVersionInfo, | 53 kReportDeviceVersionInfo, |
54 kScreenSaverExtensionId, | 54 kScreenSaverExtensionId, |
55 kScreenSaverTimeout, | 55 kScreenSaverTimeout, |
56 kSettingProxyEverywhere, | 56 kSettingProxyEverywhere, |
57 kSignedDataRoamingEnabled, | 57 kSignedDataRoamingEnabled, |
| 58 kStartUpUrls, |
58 kStatsReportingPref, | 59 kStatsReportingPref, |
59 }; | 60 }; |
60 | 61 |
61 // Upper bound for number of retries to fetch a signed setting. | 62 // Upper bound for number of retries to fetch a signed setting. |
62 static const int kNumRetriesLimit = 9; | 63 static const int kNumRetriesLimit = 9; |
63 | 64 |
64 // Legacy policy file location. Used to detect migration from pre v12 ChromeOS. | 65 // Legacy policy file location. Used to detect migration from pre v12 ChromeOS. |
65 const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences"; | 66 const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences"; |
66 | 67 |
67 bool IsControlledSetting(const std::string& pref_path) { | 68 bool IsControlledSetting(const std::string& pref_path) { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // intended to be customizable by the user: | 283 // intended to be customizable by the user: |
283 // kAppPack | 284 // kAppPack |
284 // kIdleLogoutTimeout, | 285 // kIdleLogoutTimeout, |
285 // kIdleLogoutWarningDuration, | 286 // kIdleLogoutWarningDuration, |
286 // kReleaseChannelDelegated, | 287 // kReleaseChannelDelegated, |
287 // kReportDeviceVersionInfo | 288 // kReportDeviceVersionInfo |
288 // kReportDeviceActivityTimes | 289 // kReportDeviceActivityTimes |
289 // kReportDeviceBootMode | 290 // kReportDeviceBootMode |
290 // kScreenSaverExtensionId, | 291 // kScreenSaverExtensionId, |
291 // kScreenSaverTimeout, | 292 // kScreenSaverTimeout, |
| 293 // kStartUpUrls |
292 | 294 |
293 NOTREACHED(); | 295 NOTREACHED(); |
294 } | 296 } |
295 data.set_policy_value(pol.SerializeAsString()); | 297 data.set_policy_value(pol.SerializeAsString()); |
296 // Set the cache to the updated value. | 298 // Set the cache to the updated value. |
297 policy_ = data; | 299 policy_ = data; |
298 UpdateValuesCache(); | 300 UpdateValuesCache(); |
299 | 301 |
300 if (!signed_settings_cache::Store(data, g_browser_process->local_state())) | 302 if (!signed_settings_cache::Store(data, g_browser_process->local_state())) |
301 LOG(ERROR) << "Couldn't store to the temp storage."; | 303 LOG(ERROR) << "Couldn't store to the temp storage."; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 if (it->has_update_url()) | 433 if (it->has_update_url()) |
432 entry->SetString(policy::AppPackUpdater::kUpdateUrl, it->update_url()); | 434 entry->SetString(policy::AppPackUpdater::kUpdateUrl, it->update_url()); |
433 if (it->has_online_only()) { | 435 if (it->has_online_only()) { |
434 entry->SetBoolean(policy::AppPackUpdater::kOnlineOnly, | 436 entry->SetBoolean(policy::AppPackUpdater::kOnlineOnly, |
435 it->online_only()); | 437 it->online_only()); |
436 } | 438 } |
437 list->Append(entry); | 439 list->Append(entry); |
438 } | 440 } |
439 new_values_cache->SetValue(kAppPack, list); | 441 new_values_cache->SetValue(kAppPack, list); |
440 } | 442 } |
| 443 |
| 444 if (policy.has_start_up_urls()) { |
| 445 base::ListValue* list = new base::ListValue(); |
| 446 const em::StartUpUrlsProto& urls_proto = policy.start_up_urls(); |
| 447 const RepeatedPtrField<std::string>& urls = urls_proto.start_up_urls(); |
| 448 for (RepeatedPtrField<std::string>::const_iterator it = urls.begin(); |
| 449 it != urls.end(); ++it) { |
| 450 list->Append(base::Value::CreateStringValue(*it)); |
| 451 } |
| 452 new_values_cache->SetValue(kStartUpUrls, list); |
| 453 } |
441 } | 454 } |
442 | 455 |
443 void DeviceSettingsProvider::DecodeNetworkPolicies( | 456 void DeviceSettingsProvider::DecodeNetworkPolicies( |
444 const em::ChromeDeviceSettingsProto& policy, | 457 const em::ChromeDeviceSettingsProto& policy, |
445 PrefValueMap* new_values_cache) const { | 458 PrefValueMap* new_values_cache) const { |
446 new_values_cache->SetBoolean( | 459 new_values_cache->SetBoolean( |
447 kSignedDataRoamingEnabled, | 460 kSignedDataRoamingEnabled, |
448 policy.has_data_roaming_enabled() && | 461 policy.has_data_roaming_enabled() && |
449 policy.data_roaming_enabled().has_data_roaming_enabled() && | 462 policy.data_roaming_enabled().has_data_roaming_enabled() && |
450 policy.data_roaming_enabled().data_roaming_enabled()); | 463 policy.data_roaming_enabled().data_roaming_enabled()); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 Reload(); | 735 Reload(); |
723 return; | 736 return; |
724 } | 737 } |
725 LOG(ERROR) << "No retries left"; | 738 LOG(ERROR) << "No retries left"; |
726 break; | 739 break; |
727 } | 740 } |
728 } | 741 } |
729 } | 742 } |
730 | 743 |
731 } // namespace chromeos | 744 } // namespace chromeos |
OLD | NEW |