-bool GeneratePrefFile(const base::FilePath& user_data_dir,
- const installer::MasterPreferences& master_prefs) {
- base::FilePath user_prefs = GetDefaultPrefFilePath(true, user_data_dir);
- if (user_prefs.empty())
- return false;
-
- const base::DictionaryValue& master_prefs_dict =
- master_prefs.master_dictionary();
-
- JSONFileValueSerializer serializer(user_prefs);
-
- // Call Serialize (which does IO) on the main thread, which would _normally_
- // be verboten. In this case however, we require this IO to synchronously
- // complete before Chrome can start (as master preferences seed the Local
- // State and Preferences files). This won't trip ThreadIORestrictions as they
- // won't have kicked in yet on the main thread.
- return serializer.Serialize(master_prefs_dict);
-}
-