Chromium Code Reviews| Index: chrome/installer/util/master_preferences.cc |
| diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc |
| index 2f7ccb696098ecf766689e8fc515caf039eacc72..a73099dcd3541de18689112741fa3a6e02318565 100644 |
| --- a/chrome/installer/util/master_preferences.cc |
| +++ b/chrome/installer/util/master_preferences.cc |
| @@ -207,17 +207,47 @@ bool MasterPreferences::InitializeFromString(const std::string& json_data) { |
| } |
| void MasterPreferences::EnforceLegacyPreferences() { |
| + // Boolean. This is a legacy preference and should no longer be used; it is |
| + // kept around so that old master_preferences which specify |
| + // "create_all_shortcuts":false still enforce the new |
| + // "do_not_create_(desktop|quick_launch)_shortcut" preferences. Setting this |
| + // to true no longer has any impact. |
| + static constexpr char kCreateAllShortcuts[] = "create_all_shortcuts"; |
| + |
| // If create_all_shortcuts was explicitly set to false, set |
| // do_not_create_(desktop|quick_launch)_shortcut to true. |
| bool create_all_shortcuts = true; |
| - GetBool(installer::master_preferences::kCreateAllShortcuts, |
| - &create_all_shortcuts); |
| + GetBool(kCreateAllShortcuts, &create_all_shortcuts); |
| if (!create_all_shortcuts) { |
| distribution_->SetBoolean( |
| installer::master_preferences::kDoNotCreateDesktopShortcut, true); |
| distribution_->SetBoolean( |
| installer::master_preferences::kDoNotCreateQuickLaunchShortcut, true); |
| } |
| + |
| + // Deprecated boolean import master preferences now mapped to their duplicate |
|
grt (UTC plus 2)
2017/02/23 21:19:01
duplicate -> duplicates
gab
2017/02/23 23:27:53
Done.
|
| + // in prefs::. |
| + static constexpr char kDistroImportHistoryPref[] = "import_history"; |
| + static constexpr char kDistroImportHomePagePref[] = "import_home_page"; |
| + static constexpr char kDistroImportSearchPref[] = "import_search_engine"; |
| + static constexpr char kDistroImportBookmarksPref[] = "import_bookmarks"; |
| + |
| + static constexpr struct { |
| + const char* old_distro_pref_path; |
| + const char* modern_pref_path; |
| + } kLegacyDistroImportPrefMappings[] = { |
| + {kDistroImportHistoryPref, prefs::kImportHistory}, |
| + {kDistroImportHomePagePref, prefs::kImportHomepage}, |
| + {kDistroImportSearchPref, prefs::kImportSearchEngine}, |
| + {kDistroImportBookmarksPref, prefs::kImportBookmarks}, |
| + }; |
| + |
| + for (const auto& mapping : kLegacyDistroImportPrefMappings) { |
| + bool value = false; |
| + if (GetBool(mapping.old_distro_pref_path, &value)) { |
|
grt (UTC plus 2)
2017/02/23 21:19:01
nit: omit braces
gab
2017/02/23 23:27:53
Done.
|
| + master_dictionary_->SetBoolean(mapping.modern_pref_path, value); |
| + } |
| + } |
| } |
| bool MasterPreferences::GetBool(const std::string& name, bool* value) const { |