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 29 matching lines...) Expand all Loading... |
40 kAccountsPrefAllowGuest, | 40 kAccountsPrefAllowGuest, |
41 kAccountsPrefAllowNewUser, | 41 kAccountsPrefAllowNewUser, |
42 kAccountsPrefEphemeralUsersEnabled, | 42 kAccountsPrefEphemeralUsersEnabled, |
43 kAccountsPrefShowUserNamesOnSignIn, | 43 kAccountsPrefShowUserNamesOnSignIn, |
44 kAccountsPrefUsers, | 44 kAccountsPrefUsers, |
45 kAppPack, | 45 kAppPack, |
46 kDeviceOwner, | 46 kDeviceOwner, |
47 kIdleLogoutTimeout, | 47 kIdleLogoutTimeout, |
48 kIdleLogoutWarningDuration, | 48 kIdleLogoutWarningDuration, |
49 kReleaseChannel, | 49 kReleaseChannel, |
| 50 kReleaseChannelDelegated, |
50 kReportDeviceActivityTimes, | 51 kReportDeviceActivityTimes, |
51 kReportDeviceBootMode, | 52 kReportDeviceBootMode, |
52 kReportDeviceVersionInfo, | 53 kReportDeviceVersionInfo, |
53 kScreenSaverExtensionId, | 54 kScreenSaverExtensionId, |
54 kScreenSaverTimeout, | 55 kScreenSaverTimeout, |
55 kSettingProxyEverywhere, | 56 kSettingProxyEverywhere, |
56 kSignedDataRoamingEnabled, | 57 kSignedDataRoamingEnabled, |
57 kStatsReportingPref, | 58 kStatsReportingPref, |
58 }; | 59 }; |
59 | 60 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 ephemeral_users_enabled->set_ephemeral_users_enabled( | 276 ephemeral_users_enabled->set_ephemeral_users_enabled( |
276 ephemeral_users_enabled_value); | 277 ephemeral_users_enabled_value); |
277 else | 278 else |
278 NOTREACHED(); | 279 NOTREACHED(); |
279 } else { | 280 } else { |
280 // The remaining settings don't support Set(), since they are not | 281 // The remaining settings don't support Set(), since they are not |
281 // intended to be customizable by the user: | 282 // intended to be customizable by the user: |
282 // kAppPack | 283 // kAppPack |
283 // kIdleLogoutTimeout, | 284 // kIdleLogoutTimeout, |
284 // kIdleLogoutWarningDuration, | 285 // kIdleLogoutWarningDuration, |
| 286 // kReleaseChannelDelegated, |
285 // kReportDeviceVersionInfo | 287 // kReportDeviceVersionInfo |
286 // kReportDeviceActivityTimes | 288 // kReportDeviceActivityTimes |
287 // kReportDeviceBootMode | 289 // kReportDeviceBootMode |
288 // kScreenSaverExtensionId, | 290 // kScreenSaverExtensionId, |
289 // kScreenSaverTimeout, | 291 // kScreenSaverTimeout, |
290 | 292 |
291 NOTREACHED(); | 293 NOTREACHED(); |
292 } | 294 } |
293 data.set_policy_value(pol.SerializeAsString()); | 295 data.set_policy_value(pol.SerializeAsString()); |
294 // Set the cache to the updated value. | 296 // Set the cache to the updated value. |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 } | 487 } |
486 | 488 |
487 if (!policy.has_release_channel() || | 489 if (!policy.has_release_channel() || |
488 !policy.release_channel().has_release_channel()) { | 490 !policy.release_channel().has_release_channel()) { |
489 // Default to an invalid channel (will be ignored). | 491 // Default to an invalid channel (will be ignored). |
490 new_values_cache->SetString(kReleaseChannel, ""); | 492 new_values_cache->SetString(kReleaseChannel, ""); |
491 } else { | 493 } else { |
492 new_values_cache->SetString(kReleaseChannel, | 494 new_values_cache->SetString(kReleaseChannel, |
493 policy.release_channel().release_channel()); | 495 policy.release_channel().release_channel()); |
494 } | 496 } |
| 497 |
| 498 new_values_cache->SetBoolean( |
| 499 kReleaseChannelDelegated, |
| 500 policy.has_release_channel() && |
| 501 policy.release_channel().has_release_channel_delegated() && |
| 502 policy.release_channel().release_channel_delegated()); |
495 } | 503 } |
496 | 504 |
497 void DeviceSettingsProvider::UpdateValuesCache() { | 505 void DeviceSettingsProvider::UpdateValuesCache() { |
498 const em::PolicyData data = policy(); | 506 const em::PolicyData data = policy(); |
499 PrefValueMap new_values_cache; | 507 PrefValueMap new_values_cache; |
500 | 508 |
501 if (data.has_username() && !data.has_request_token()) | 509 if (data.has_username() && !data.has_request_token()) |
502 new_values_cache.SetString(kDeviceOwner, data.username()); | 510 new_values_cache.SetString(kDeviceOwner, data.username()); |
503 | 511 |
504 em::ChromeDeviceSettingsProto pol; | 512 em::ChromeDeviceSettingsProto pol; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 Reload(); | 722 Reload(); |
715 return; | 723 return; |
716 } | 724 } |
717 LOG(ERROR) << "No retries left"; | 725 LOG(ERROR) << "No retries left"; |
718 break; | 726 break; |
719 } | 727 } |
720 } | 728 } |
721 } | 729 } |
722 | 730 |
723 } // namespace chromeos | 731 } // namespace chromeos |
OLD | NEW |