diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 21:58:56 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 21:58:56 +0000 |
commit | 5f8d121f337433a9426cfbbf87c4adbe93ce3459 (patch) | |
tree | 91dbc7227ebbab7ea7b63ed4dd05d1d820de951b /chrome | |
parent | 582bca833f4c2cc1d255c18c54f630f47cc35186 (diff) | |
download | chromium_src-5f8d121f337433a9426cfbbf87c4adbe93ce3459.zip chromium_src-5f8d121f337433a9426cfbbf87c4adbe93ce3459.tar.gz chromium_src-5f8d121f337433a9426cfbbf87c4adbe93ce3459.tar.bz2 |
Fix distribution key bug.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22202 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/installer/setup/setup_main.cc | 41 | ||||
-rw-r--r-- | chrome/installer/util/master_preferences.cc | 15 | ||||
-rw-r--r-- | chrome/installer/util/master_preferences.h | 10 |
3 files changed, 40 insertions, 26 deletions
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index daae996..eb2e8ba 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -207,45 +207,42 @@ installer_util::InstallStatus RenameChromeExecutables(bool system_install) { // Parse command line and read master profile, if present, to get distribution // related install options. DictionaryValue* GetInstallPreferences(const CommandLine& cmd_line) { - DictionaryValue* preferences = NULL; + DictionaryValue* prefs = NULL; if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) { FilePath prefs_path( cmd_line.GetSwitchValue(installer_util::switches::kInstallerData)); - preferences = installer_util::ParseDistributionPreferences(prefs_path); - if (preferences) - preferences->SetBoolean( - installer_util::master_preferences::kMasterPreferencesValid, true); + prefs = installer_util::ParseDistributionPreferences(prefs_path); } - if (!preferences) - preferences = new DictionaryValue(); + if (!prefs) + prefs = new DictionaryValue(); if (cmd_line.HasSwitch(installer_util::switches::kCreateAllShortcuts)) - preferences->SetBoolean( - installer_util::master_preferences::kCreateAllShortcuts, true); + installer_util::SetDistroBooleanPreference( + prefs, installer_util::master_preferences::kCreateAllShortcuts, true); if (cmd_line.HasSwitch(installer_util::switches::kDoNotLaunchChrome)) - preferences->SetBoolean( - installer_util::master_preferences::kDoNotLaunchChrome, true); + installer_util::SetDistroBooleanPreference( + prefs, installer_util::master_preferences::kDoNotLaunchChrome, true); if (cmd_line.HasSwitch(installer_util::switches::kMakeChromeDefault)) - preferences->SetBoolean( - installer_util::master_preferences::kMakeChromeDefault, true); + installer_util::SetDistroBooleanPreference( + prefs, installer_util::master_preferences::kMakeChromeDefault, true); if (cmd_line.HasSwitch(installer_util::switches::kSystemLevel)) - preferences->SetBoolean( - installer_util::master_preferences::kSystemLevel, true); + installer_util::SetDistroBooleanPreference( + prefs, installer_util::master_preferences::kSystemLevel, true); if (cmd_line.HasSwitch(installer_util::switches::kVerboseLogging)) - preferences->SetBoolean( - installer_util::master_preferences::kVerboseLogging, true); + installer_util::SetDistroBooleanPreference( + prefs, installer_util::master_preferences::kVerboseLogging, true); if (cmd_line.HasSwitch(installer_util::switches::kAltDesktopShortcut)) - preferences->SetBoolean( - installer_util::master_preferences::kAltShortcutText, true); + installer_util::SetDistroBooleanPreference( + prefs, installer_util::master_preferences::kAltShortcutText, true); - return preferences; + return prefs; } // Copy master preferences file provided to installer, in the same folder @@ -395,9 +392,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, install_msg_base, &chrome_exe); if (install_status == installer_util::FIRST_INSTALL_SUCCESS) { LOG(INFO) << "First install successful."; - if (installer_util::GetDistroBooleanPreference(prefs, - installer_util::master_preferences::kMasterPreferencesValid)) - CopyPreferenceFileForFirstRun(system_level, cmd_line); + CopyPreferenceFileForFirstRun(system_level, cmd_line); // We never want to launch Chrome in system level install mode. if (!system_level && !installer_util::GetDistroBooleanPreference(prefs, installer_util::master_preferences::kDoNotLaunchChrome)) diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index c43c422..f8c8018 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -46,7 +46,6 @@ const wchar_t kDistroSkipFirstRunPref[] = L"skip_first_run_ui"; const wchar_t kDoNotLaunchChrome[] = L"do_not_launch_chrome"; const wchar_t kMakeChromeDefault[] = L"make_chrome_default"; const wchar_t kMakeChromeDefaultForUser[] = L"make_chrome_default_for_user"; -const wchar_t kMasterPreferencesValid[] = L"master_preferencs_valid"; const wchar_t kRequireEula[] = L"require_eula"; const wchar_t kSystemLevel[] = L"system_level"; const wchar_t kVerboseLogging[] = L"verbose_logging"; @@ -111,4 +110,18 @@ std::vector<std::wstring> GetFirstRunTabs(const DictionaryValue* prefs) { return launch_tabs; } +bool SetDistroBooleanPreference(DictionaryValue* prefs, + const std::wstring& name, + bool value) { + + bool ret = false; + if (prefs && !name.empty()) { + std::wstring key(kDistroDict); + key.append(L"." + name); + if (prefs->SetBoolean(key, value)) + ret = true; + } + return ret; +} + } // installer_util diff --git a/chrome/installer/util/master_preferences.h b/chrome/installer/util/master_preferences.h index 3ac4561..d9efb3d 100644 --- a/chrome/installer/util/master_preferences.h +++ b/chrome/installer/util/master_preferences.h @@ -45,8 +45,6 @@ extern const wchar_t kDoNotLaunchChrome[]; extern const wchar_t kMakeChromeDefault[]; // Boolean. Register Chrome as default browser for the current user. extern const wchar_t kMakeChromeDefaultForUser[]; -// Boolean but only meant to be used for internal purposes. -extern const wchar_t kMasterPreferencesValid[]; // Boolean. Show EULA dialog before install. extern const wchar_t kRequireEula[]; // Boolean. Install Chrome to system wise location. Cmd line override present. @@ -59,6 +57,8 @@ extern const wchar_t kVerboseLogging[]; // values in the user profile at first run. const wchar_t kDefaultMasterPrefs[] = L"master_preferences"; +// Gets the value of given boolean preference |name| from |prefs| dictionary +// which is assumed to contain a dictionary named "distribution". bool GetDistroBooleanPreference(const DictionaryValue* prefs, const std::wstring& name); @@ -128,6 +128,12 @@ DictionaryValue* ParseDistributionPreferences( // This function retuns the list as a vector of strings. If the master // preferences file does not contain such list the vector is empty. std::vector<std::wstring> GetFirstRunTabs(const DictionaryValue* prefs); + +// Sets the value of given boolean preference |name| in "distribution" +// dictionary inside |prefs| dictionary. +bool SetDistroBooleanPreference(DictionaryValue* prefs, + const std::wstring& name, + bool value); } #endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H_ |