Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3610)

Unified Diff: chrome/installer/util/master_preferences.cc

Issue 2507293005: Force migrate all clients from multi-install back to single-install. (Closed)
Patch Set: mini_installer too Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/master_preferences.cc
diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc
index 8ec3e04ece6f82072f1e24ce04a682f5d69b0a7b..f71c3000a012994aebbcbc4c915d346ff131193f 100644
--- a/chrome/installer/util/master_preferences.cc
+++ b/chrome/installer/util/master_preferences.cc
@@ -75,34 +75,19 @@ base::DictionaryValue* ParseDistributionPreferences(
namespace installer {
-MasterPreferences::MasterPreferences() : distribution_(NULL),
- preferences_read_from_file_(false),
- chrome_(true),
- multi_install_(false) {
+MasterPreferences::MasterPreferences() {
InitializeFromCommandLine(*base::CommandLine::ForCurrentProcess());
}
-MasterPreferences::MasterPreferences(const base::CommandLine& cmd_line)
- : distribution_(NULL),
- preferences_read_from_file_(false),
- chrome_(true),
- multi_install_(false) {
+MasterPreferences::MasterPreferences(const base::CommandLine& cmd_line) {
InitializeFromCommandLine(cmd_line);
}
-MasterPreferences::MasterPreferences(const base::FilePath& prefs_path)
- : distribution_(NULL),
- preferences_read_from_file_(false),
- chrome_(true),
- multi_install_(false) {
+MasterPreferences::MasterPreferences(const base::FilePath& prefs_path) {
InitializeFromFilePath(prefs_path);
}
-MasterPreferences::MasterPreferences(const std::string& prefs)
- : distribution_(NULL),
- preferences_read_from_file_(false),
- chrome_(true),
- multi_install_(false) {
+MasterPreferences::MasterPreferences(const std::string& prefs) {
InitializeFromString(prefs);
}
@@ -129,14 +114,10 @@ void MasterPreferences::InitializeFromCommandLine(
const char* cmd_line_switch;
const char* distribution_switch;
} translate_switches[] = {
- { installer::switches::kChrome,
- installer::master_preferences::kChrome },
{ installer::switches::kDisableLogging,
installer::master_preferences::kDisableLogging },
{ installer::switches::kMsi,
installer::master_preferences::kMsi },
- { installer::switches::kMultiInstall,
- installer::master_preferences::kMultiInstall },
{ installer::switches::kDoNotRegisterForUpdateLaunch,
installer::master_preferences::kDoNotRegisterForUpdateLaunch },
{ installer::switches::kDoNotLaunchChrome,
@@ -181,11 +162,14 @@ void MasterPreferences::InitializeFromCommandLine(
}
}
+ // Strip multi-install from the dictionary, if present.
+ master_dictionary_->Remove(std::string(master_preferences::kDistroDict) +
+ '.' + master_preferences::kMultiInstall,
gab 2016/12/12 21:38:16 Why bother stripping it? We're not stripping kChro
grt (UTC plus 2) 2016/12/13 09:20:37 This is an insurance policy against code that look
gab 2016/12/14 16:33:38 Got it, can you clarify the comment to that effect
+ nullptr);
+
// Cache a pointer to the distribution dictionary. Ignore errors if any.
master_dictionary_->GetDictionary(installer::master_preferences::kDistroDict,
&distribution_);
-
- InitializeProductFlags();
#endif
}
@@ -217,30 +201,10 @@ bool MasterPreferences::InitializeFromString(const std::string& json_data) {
installer::master_preferences::kDistroDict, &distribution_);
}
- InitializeProductFlags();
EnforceLegacyPreferences();
return data_is_valid;
}
-void MasterPreferences::InitializeProductFlags() {
- // Make sure we start out with the correct defaults.
- multi_install_ = false;
- chrome_ = true;
-
- GetBool(installer::master_preferences::kMultiInstall, &multi_install_);
-
- // When multi-install is specified, the checks are pretty simple (in theory):
- // In order to be installed/uninstalled, each product must have its switch
- // present on the command line.
- // When multi-install is not set, operate on Chrome.
- if (multi_install_) {
- if (!GetBool(installer::master_preferences::kChrome, &chrome_))
- chrome_ = false;
- } else {
- chrome_ = true;
- }
-}
-
void MasterPreferences::EnforceLegacyPreferences() {
// If create_all_shortcuts was explicitly set to false, set
// do_not_create_(desktop|quick_launch)_shortcut to true.

Powered by Google App Engine
This is Rietveld 408576698