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/installer/util/master_preferences.h" | 5 #include "chrome/installer/util/master_preferences.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // do_not_create_(desktop|quick_launch)_shortcut to true. | 219 // do_not_create_(desktop|quick_launch)_shortcut to true. |
220 bool create_all_shortcuts = true; | 220 bool create_all_shortcuts = true; |
221 GetBool(kCreateAllShortcuts, &create_all_shortcuts); | 221 GetBool(kCreateAllShortcuts, &create_all_shortcuts); |
222 if (!create_all_shortcuts) { | 222 if (!create_all_shortcuts) { |
223 distribution_->SetBoolean( | 223 distribution_->SetBoolean( |
224 installer::master_preferences::kDoNotCreateDesktopShortcut, true); | 224 installer::master_preferences::kDoNotCreateDesktopShortcut, true); |
225 distribution_->SetBoolean( | 225 distribution_->SetBoolean( |
226 installer::master_preferences::kDoNotCreateQuickLaunchShortcut, true); | 226 installer::master_preferences::kDoNotCreateQuickLaunchShortcut, true); |
227 } | 227 } |
228 | 228 |
| 229 // Deprecated boolean import master preferences now mapped to their duplicates |
| 230 // in prefs::. |
| 231 static constexpr char kDistroImportHistoryPref[] = "import_history"; |
| 232 static constexpr char kDistroImportHomePagePref[] = "import_home_page"; |
| 233 static constexpr char kDistroImportSearchPref[] = "import_search_engine"; |
| 234 static constexpr char kDistroImportBookmarksPref[] = "import_bookmarks"; |
| 235 |
| 236 static constexpr struct { |
| 237 const char* old_distro_pref_path; |
| 238 const char* modern_pref_path; |
| 239 } kLegacyDistroImportPrefMappings[] = { |
| 240 {kDistroImportBookmarksPref, prefs::kImportBookmarks}, |
| 241 {kDistroImportHistoryPref, prefs::kImportHistory}, |
| 242 {kDistroImportHomePagePref, prefs::kImportHomepage}, |
| 243 {kDistroImportSearchPref, prefs::kImportSearchEngine}, |
| 244 }; |
| 245 |
| 246 for (const auto& mapping : kLegacyDistroImportPrefMappings) { |
| 247 bool value = false; |
| 248 if (GetBool(mapping.old_distro_pref_path, &value)) |
| 249 master_dictionary_->SetBoolean(mapping.modern_pref_path, value); |
| 250 } |
| 251 |
229 #if BUILDFLAG(ENABLE_RLZ) | 252 #if BUILDFLAG(ENABLE_RLZ) |
230 // Map the RLZ ping delay shipped in the distribution dictionary into real | 253 // Map the RLZ ping delay shipped in the distribution dictionary into real |
231 // prefs. | 254 // prefs. |
232 static constexpr char kDistroPingDelay[] = "ping_delay"; | 255 static constexpr char kDistroPingDelay[] = "ping_delay"; |
233 int rlz_ping_delay = 0; | 256 int rlz_ping_delay = 0; |
234 if (GetInt(kDistroPingDelay, &rlz_ping_delay)) | 257 if (GetInt(kDistroPingDelay, &rlz_ping_delay)) |
235 master_dictionary_->SetInteger(prefs::kRlzPingDelaySeconds, rlz_ping_delay); | 258 master_dictionary_->SetInteger(prefs::kRlzPingDelaySeconds, rlz_ping_delay); |
236 #endif // BUILDFLAG(ENABLE_RLZ) | 259 #endif // BUILDFLAG(ENABLE_RLZ) |
237 } | 260 } |
238 | 261 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 313 } |
291 return result; | 314 return result; |
292 } | 315 } |
293 | 316 |
294 // static | 317 // static |
295 const MasterPreferences& MasterPreferences::ForCurrentProcess() { | 318 const MasterPreferences& MasterPreferences::ForCurrentProcess() { |
296 return g_master_preferences.Get(); | 319 return g_master_preferences.Get(); |
297 } | 320 } |
298 | 321 |
299 } // namespace installer | 322 } // namespace installer |
OLD | NEW |