| 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 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // device settings before the device is owned and to speed up policy | 70 // device settings before the device is owned and to speed up policy |
| 71 // availability before the policy blob is fetched on boot. | 71 // availability before the policy blob is fetched on boot. |
| 72 void RetrieveCachedData(); | 72 void RetrieveCachedData(); |
| 73 | 73 |
| 74 // Parses the policy data and fills in |values_cache_|. | 74 // Parses the policy data and fills in |values_cache_|. |
| 75 void UpdateValuesCache( | 75 void UpdateValuesCache( |
| 76 const enterprise_management::PolicyData& policy_data, | 76 const enterprise_management::PolicyData& policy_data, |
| 77 const enterprise_management::ChromeDeviceSettingsProto& settings, | 77 const enterprise_management::ChromeDeviceSettingsProto& settings, |
| 78 TrustedStatus trusted_status); | 78 TrustedStatus trusted_status); |
| 79 | 79 |
| 80 // Applies the metrics policy and if not set migrates the legacy file. | |
| 81 void ApplyMetricsSetting(bool use_file, bool new_value); | |
| 82 | |
| 83 // Applies the data roaming policy. | 80 // Applies the data roaming policy. |
| 84 void ApplyRoamingSetting(bool new_value); | 81 void ApplyRoamingSetting(bool new_value); |
| 85 void ApplyRoamingSettingFromProto( | 82 void ApplyRoamingSettingFromProto( |
| 86 const enterprise_management::ChromeDeviceSettingsProto& settings); | 83 const enterprise_management::ChromeDeviceSettingsProto& settings); |
| 87 | 84 |
| 88 // Applies any changes of the policies that are not handled by the respective | |
| 89 // subsystems. | |
| 90 void ApplySideEffects( | |
| 91 const enterprise_management::ChromeDeviceSettingsProto& settings); | |
| 92 | |
| 93 // In case of missing policy blob we should verify if this is upgrade of | 85 // In case of missing policy blob we should verify if this is upgrade of |
| 94 // machine owned from pre version 12 OS and the user never touched the device | 86 // machine owned from pre version 12 OS and the user never touched the device |
| 95 // settings. In this case revert to defaults and let people in until the owner | 87 // settings. In this case revert to defaults and let people in until the owner |
| 96 // comes and changes that. | 88 // comes and changes that. |
| 97 bool MitigateMissingPolicy(); | 89 bool MitigateMissingPolicy(); |
| 98 | 90 |
| 99 // Checks if the current cache value can be trusted for being representative | 91 // Checks if the current cache value can be trusted for being representative |
| 100 // for the disk cache. | 92 // for the disk cache. |
| 101 TrustedStatus RequestTrustedEntity(); | 93 TrustedStatus RequestTrustedEntity(); |
| 102 | 94 |
| 103 // Invokes UpdateFromService() to synchronize with |device_settings_service_|, | 95 // Invokes UpdateFromService() to synchronize with |device_settings_service_|, |
| 104 // then triggers the next store operation if applicable. | 96 // then triggers the next store operation if applicable. |
| 105 void UpdateAndProceedStoring(); | 97 void UpdateAndProceedStoring(); |
| 106 | 98 |
| 107 // Re-reads state from |device_settings_service_|, adjusts | 99 // Re-reads state from |device_settings_service_|, adjusts |
| 108 // |trusted_status_| and calls UpdateValuesCache() if applicable. Returns true | 100 // |trusted_status_| and calls UpdateValuesCache() if applicable. Returns true |
| 109 // if new settings have been loaded. | 101 // if new settings have been loaded. |
| 110 bool UpdateFromService(); | 102 bool UpdateFromService(); |
| 111 | 103 |
| 112 // Checks the current ownership status to see whether the device owner is | |
| 113 // logged in and writes the data accumulated in |migration_values_| to proper | |
| 114 // device settings. | |
| 115 void AttemptMigration(); | |
| 116 | |
| 117 // Pending callbacks that need to be invoked after settings verification. | 104 // Pending callbacks that need to be invoked after settings verification. |
| 118 std::vector<base::Closure> callbacks_; | 105 std::vector<base::Closure> callbacks_; |
| 119 | 106 |
| 120 DeviceSettingsService* device_settings_service_; | 107 DeviceSettingsService* device_settings_service_; |
| 121 mutable PrefValueMap migration_values_; | 108 mutable PrefValueMap migration_values_; |
| 122 | 109 |
| 123 TrustedStatus trusted_status_; | 110 TrustedStatus trusted_status_; |
| 124 DeviceSettingsService::OwnershipStatus ownership_status_; | 111 DeviceSettingsService::OwnershipStatus ownership_status_; |
| 125 | 112 |
| 126 // The device settings as currently reported through the | 113 // The device settings as currently reported through the |
| (...skipping 17 matching lines...) Expand all Loading... |
| 144 InitializationTestUnowned); | 131 InitializationTestUnowned); |
| 145 FRIEND_TEST_ALL_PREFIXES(DeviceSettingsProviderTest, | 132 FRIEND_TEST_ALL_PREFIXES(DeviceSettingsProviderTest, |
| 146 PolicyFailedPermanentlyNotification); | 133 PolicyFailedPermanentlyNotification); |
| 147 FRIEND_TEST_ALL_PREFIXES(DeviceSettingsProviderTest, PolicyLoadNotification); | 134 FRIEND_TEST_ALL_PREFIXES(DeviceSettingsProviderTest, PolicyLoadNotification); |
| 148 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProvider); | 135 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProvider); |
| 149 }; | 136 }; |
| 150 | 137 |
| 151 } // namespace chromeos | 138 } // namespace chromeos |
| 152 | 139 |
| 153 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_ | 140 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_ |
| OLD | NEW |