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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_CACHE_H_ 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_CACHE_H_ 7 8 #include <string> 9 10 namespace enterprise_management { 11 class PolicyData; 12 } 13 14 class PrefService; 15 class PrefRegistrySimple; 16 17 namespace chromeos { 18 19 // There is need (metrics at OOBE stage) to store settings (that normally would 20 // go into DeviceSettings storage) before owner has been assigned (hence no key 21 // is available). This set of functions serves as a transient storage in that 22 // case. 23 namespace device_settings_cache { 24 // Registers required pref section. 25 void RegisterPrefs(PrefRegistrySimple* registry); 26 27 // Stores a new policy blob inside the cache stored in |local_state|. 28 bool Store(const enterprise_management::PolicyData& policy, 29 PrefService* local_state); 30 31 // Retrieves the policy blob from the cache stored in |local_state|. 32 bool Retrieve(enterprise_management::PolicyData* policy, 33 PrefService* local_state); 34 35 // Call this after owner has been assigned to persist settings into 36 // DeviceSettings storage. 37 void Finalize(PrefService* local_state); 38 39 // Used to convert |policy| into a string that is saved to prefs. 40 std::string PolicyDataToString(const enterprise_management::PolicyData& policy); 41 42 } // namespace device_settings_cache 43 44 } // namespace chromeos 45 46 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_CACHE_H_ 47