summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 20:12:50 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 20:12:50 +0000
commitc604a55498cea3b78c4eafda2cb408fd16edf6af (patch)
treeb99109b879257d12a2cbe5c537d0281625946bb2 /chrome/installer/util
parent41c78fa1896c5f849c2160ae5de84c232e2c3de9 (diff)
downloadchromium_src-c604a55498cea3b78c4eafda2cb408fd16edf6af.zip
chromium_src-c604a55498cea3b78c4eafda2cb408fd16edf6af.tar.gz
chromium_src-c604a55498cea3b78c4eafda2cb408fd16edf6af.tar.bz2
Allowing MSI mode detection to work from the master preferences file.
Refactor the piece of master preferences code that was in setup_util.h|cc (setup) into master_preferences.h|cc (install_util). This adds an install_util -> googleurl dependency, which should to be fine. Add in master_preferences_dummy.cc to keep the nacl64 stuff compiling happily. Add values.h|cc to the portion of base built in 64 bit mode and add a minor fix to values.cc to make it build. Also refactor accompanying master_preferences test code from setup tests to install_util tests. BUG=19370 Review URL: http://codereview.chromium.org/979003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42248 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util')
-rw-r--r--chrome/installer/util/install_util.cc15
-rw-r--r--chrome/installer/util/install_util.h5
-rw-r--r--chrome/installer/util/master_preferences.cc82
-rw-r--r--chrome/installer/util/master_preferences.h58
-rw-r--r--chrome/installer/util/master_preferences_constants.cc32
-rw-r--r--chrome/installer/util/master_preferences_constants.h64
-rw-r--r--chrome/installer/util/master_preferences_dummy.cc68
-rw-r--r--chrome/installer/util/master_preferences_unittest.cc78
-rw-r--r--chrome/installer/util/util_constants.cc1
-rw-r--r--chrome/installer/util/util_constants.h1
10 files changed, 328 insertions, 76 deletions
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index e3e7d45..a3f32d1 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -20,10 +20,11 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/win_util.h"
-
+#include "chrome/common/json_value_serializer.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/l10n_string_util.h"
+#include "chrome/installer/util/master_preferences.h"
#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/work_item_list.h"
@@ -163,6 +164,18 @@ bool InstallUtil::IsChromeSxSProcess() {
chrome_sxs_dir);
}
+bool InstallUtil::IsMSIProcess() {
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ CHECK(command_line);
+
+ scoped_ptr<DictionaryValue> prefs(installer_util::GetInstallPreferences(
+ *command_line));
+ bool value = false;
+ return (installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kMsi, &value) &&
+ value);
+}
+
bool InstallUtil::BuildDLLRegistrationList(const std::wstring& install_path,
const wchar_t** const dll_names,
int dll_names_count,
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index f1f07c4..8a2854a 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -66,6 +66,11 @@ class InstallUtil {
// by either --chrome-sxs or the executable path).
static bool IsChromeSxSProcess();
+ // Returns true if this setup process is running as an install managed by an
+ // MSI wrapper. This is indicated by the presence of --msi on the command line
+ // or the presence of "msi": true in the master preferences file.
+ static bool IsMSIProcess();
+
// Adds all DLLs in install_path whose names are given by dll_names to a
// work item list containing registration or unregistration actions.
//
diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc
index 3cebf4b..2a6a4e7 100644
--- a/chrome/installer/util/master_preferences.cc
+++ b/chrome/installer/util/master_preferences.cc
@@ -8,8 +8,10 @@
#include "base/logging.h"
#include "base/path_service.h"
#include "chrome/common/json_value_serializer.h"
+#include "chrome/installer/util/util_constants.h"
#include "googleurl/src/gurl.h"
+
namespace {
const wchar_t* kDistroDict = L"distribution";
@@ -46,30 +48,6 @@ std::vector<GURL> GetNamedList(const wchar_t* name,
}
namespace installer_util {
-namespace master_preferences {
-const wchar_t kAltFirstRunBubble[] = L"oem_bubble";
-const wchar_t kAltShortcutText[] = L"alternate_shortcut_text";
-const wchar_t kChromeShortcutIconIndex[] = L"chrome_shortcut_icon_index";
-const wchar_t kCreateAllShortcuts[] = L"create_all_shortcuts";
-const wchar_t kDistroImportBookmarksPref[] = L"import_bookmarks";
-const wchar_t kDistroImportHistoryPref[] = L"import_history";
-const wchar_t kDistroImportHomePagePref[] = L"import_home_page";
-const wchar_t kDistroImportSearchPref[] = L"import_search_engine";
-const wchar_t kDistroPingDelay[] = L"ping_delay";
-const wchar_t kDistroShowWelcomePage[] = L"show_welcome_page";
-const wchar_t kDistroSkipFirstRunPref[] = L"skip_first_run_ui";
-const wchar_t kDoNotCreateShortcuts[] = L"do_not_create_shortcuts";
-const wchar_t kDoNotLaunchChrome[] = L"do_not_launch_chrome";
-const wchar_t kDoNotRegisterForUpdateLaunch[] =
- L"do_not_register_for_update_launch";
-const wchar_t kMakeChromeDefault[] = L"make_chrome_default";
-const wchar_t kMakeChromeDefaultForUser[] = L"make_chrome_default_for_user";
-const wchar_t kMsi[] = L"msi";
-const wchar_t kRequireEula[] = L"require_eula";
-const wchar_t kSystemLevel[] = L"system_level";
-const wchar_t kVerboseLogging[] = L"verbose_logging";
-const wchar_t kExtensionsBlock[] = L"extensions.settings";
-}
bool GetDistroBooleanPreference(const DictionaryValue* prefs,
const std::wstring& name,
@@ -103,6 +81,61 @@ bool GetDistroIntegerPreference(const DictionaryValue* prefs,
return true;
}
+DictionaryValue* GetInstallPreferences(const CommandLine& cmd_line) {
+ DictionaryValue* prefs = NULL;
+#if defined(OS_WIN)
+ if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) {
+ FilePath prefs_path(
+ cmd_line.GetSwitchValue(installer_util::switches::kInstallerData));
+ prefs = installer_util::ParseDistributionPreferences(prefs_path);
+ }
+
+ if (!prefs)
+ prefs = new DictionaryValue();
+
+ if (cmd_line.HasSwitch(installer_util::switches::kCreateAllShortcuts))
+ installer_util::SetDistroBooleanPreference(
+ prefs, installer_util::master_preferences::kCreateAllShortcuts, true);
+
+ if (cmd_line.HasSwitch(installer_util::switches::kDoNotCreateShortcuts))
+ installer_util::SetDistroBooleanPreference(
+ prefs, installer_util::master_preferences::kDoNotCreateShortcuts, true);
+
+ if (cmd_line.HasSwitch(installer_util::switches::kMsi))
+ installer_util::SetDistroBooleanPreference(
+ prefs, installer_util::master_preferences::kMsi, true);
+
+ if (cmd_line.HasSwitch(
+ installer_util::switches::kDoNotRegisterForUpdateLaunch))
+ installer_util::SetDistroBooleanPreference(
+ prefs,
+ installer_util::master_preferences::kDoNotRegisterForUpdateLaunch,
+ true);
+
+ if (cmd_line.HasSwitch(installer_util::switches::kDoNotLaunchChrome))
+ installer_util::SetDistroBooleanPreference(
+ prefs, installer_util::master_preferences::kDoNotLaunchChrome, true);
+
+ if (cmd_line.HasSwitch(installer_util::switches::kMakeChromeDefault))
+ installer_util::SetDistroBooleanPreference(
+ prefs, installer_util::master_preferences::kMakeChromeDefault, true);
+
+ if (cmd_line.HasSwitch(installer_util::switches::kSystemLevel))
+ installer_util::SetDistroBooleanPreference(
+ prefs, installer_util::master_preferences::kSystemLevel, true);
+
+ if (cmd_line.HasSwitch(installer_util::switches::kVerboseLogging))
+ installer_util::SetDistroBooleanPreference(
+ prefs, installer_util::master_preferences::kVerboseLogging, true);
+
+ if (cmd_line.HasSwitch(installer_util::switches::kAltDesktopShortcut))
+ installer_util::SetDistroBooleanPreference(
+ prefs, installer_util::master_preferences::kAltShortcutText, true);
+#endif
+
+ return prefs;
+}
+
DictionaryValue* ParseDistributionPreferences(
const FilePath& master_prefs_path) {
if (!file_util::PathExists(master_prefs_path)) {
@@ -113,6 +146,7 @@ DictionaryValue* ParseDistributionPreferences(
std::string json_data;
if (!file_util::ReadFileToString(master_prefs_path, &json_data))
return NULL;
+
JSONStringValueSerializer json(json_data);
scoped_ptr<Value> root(json.Deserialize(NULL));
diff --git a/chrome/installer/util/master_preferences.h b/chrome/installer/util/master_preferences.h
index a6da339..e244e96 100644
--- a/chrome/installer/util/master_preferences.h
+++ b/chrome/installer/util/master_preferences.h
@@ -10,67 +10,23 @@
#include <vector>
+#include "base/command_line.h"
#include "base/file_path.h"
#include "base/values.h"
#include "googleurl/src/gurl.h"
+#include "chrome/installer/util/master_preferences_constants.h"
namespace installer_util {
-namespace master_preferences {
-// All the preferences below are expected to be inside the JSON "distribution"
-// block. Some of them also have equivalent command line option. If same option
-// is specified in master preference as well as command line, the commnd line
-// value takes precedence.
-
-// Boolean. Use alternate text for the shortcut. Cmd line override present.
-extern const wchar_t kAltShortcutText[];
-// Boolean. Use alternate smaller first run info bubble.
-extern const wchar_t kAltFirstRunBubble[];
-// Integer. Icon index from chrome.exe to use for shortcuts.
-extern const wchar_t kChromeShortcutIconIndex[];
-// Boolean. Create Desktop and QuickLaunch shortcuts. Cmd line override present.
-extern const wchar_t kCreateAllShortcuts[];
-// Boolean pref that triggers silent import of the default browser bookmarks.
-extern const wchar_t kDistroImportBookmarksPref[];
-// Boolean pref that triggers silent import of the default browser history.
-extern const wchar_t kDistroImportHistoryPref[];
-// Boolean pref that triggers silent import of the default browser homepage.
-extern const wchar_t kDistroImportHomePagePref[];
-// Boolean pref that triggers silent import of the default search engine.
-extern const wchar_t kDistroImportSearchPref[];
-// Integer. RLZ ping delay in seconds.
-extern const wchar_t kDistroPingDelay[];
-// Boolean pref that triggers loading the welcome page.
-extern const wchar_t kDistroShowWelcomePage[];
-// Boolean pref that triggers skipping the first run dialogs.
-extern const wchar_t kDistroSkipFirstRunPref[];
-// Boolean. Do not create Chrome desktop shortcuts. Cmd line override present.
-extern const wchar_t kDoNotCreateShortcuts[];
-// Boolean. Do not launch Chrome after first install. Cmd line override present.
-extern const wchar_t kDoNotLaunchChrome[];
-// Boolean. Do not register with Google Update to have Chrome launched after
-// install. Cmd line override present.
-extern const wchar_t kDoNotRegisterForUpdateLaunch[];
-// Boolean. Register Chrome as default browser. Cmd line override present.
-extern const wchar_t kMakeChromeDefault[];
-// Boolean. Register Chrome as default browser for the current user.
-extern const wchar_t kMakeChromeDefaultForUser[];
-// Boolean. Expect to be run by an MSI installer. Cmd line override present.
-extern const wchar_t kMsi[];
-// Boolean. Show EULA dialog before install.
-extern const wchar_t kRequireEula[];
-// Boolean. Install Chrome to system wise location. Cmd line override present.
-extern const wchar_t kSystemLevel[];
-// Boolean. Run installer in verbose mode. Cmd line override present.
-extern const wchar_t kVerboseLogging[];
-// Name of the block that contains the extensions on the master preferences.
-extern const wchar_t kExtensionsBlock[];
-}
-
// This is the default name for the master preferences file used to pre-set
// values in the user profile at first run.
const char kDefaultMasterPrefs[] = "master_preferences";
+// Parse command line and read master preferences, if present, to get
+// distribution related install options. Merge them if any command line
+// options present (command line value takes precedence).
+DictionaryValue* GetInstallPreferences(const CommandLine& cmd_line);
+
// Gets the value of given boolean preference |name| from |prefs| dictionary
// which is assumed to contain a dictionary named "distribution". Returns
// true if the value is read successfully, otherwise false.
diff --git a/chrome/installer/util/master_preferences_constants.cc b/chrome/installer/util/master_preferences_constants.cc
new file mode 100644
index 0000000..6519e4c
--- /dev/null
+++ b/chrome/installer/util/master_preferences_constants.cc
@@ -0,0 +1,32 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/installer/util/master_preferences_constants.h"
+
+namespace installer_util {
+namespace master_preferences {
+ const wchar_t kAltFirstRunBubble[] = L"oem_bubble";
+ const wchar_t kAltShortcutText[] = L"alternate_shortcut_text";
+ const wchar_t kChromeShortcutIconIndex[] = L"chrome_shortcut_icon_index";
+ const wchar_t kCreateAllShortcuts[] = L"create_all_shortcuts";
+ const wchar_t kDistroImportBookmarksPref[] = L"import_bookmarks";
+ const wchar_t kDistroImportHistoryPref[] = L"import_history";
+ const wchar_t kDistroImportHomePagePref[] = L"import_home_page";
+ const wchar_t kDistroImportSearchPref[] = L"import_search_engine";
+ const wchar_t kDistroPingDelay[] = L"ping_delay";
+ const wchar_t kDistroShowWelcomePage[] = L"show_welcome_page";
+ const wchar_t kDistroSkipFirstRunPref[] = L"skip_first_run_ui";
+ const wchar_t kDoNotCreateShortcuts[] = L"do_not_create_shortcuts";
+ const wchar_t kDoNotLaunchChrome[] = L"do_not_launch_chrome";
+ const wchar_t kDoNotRegisterForUpdateLaunch[] =
+ L"do_not_register_for_update_launch";
+ const wchar_t kMakeChromeDefault[] = L"make_chrome_default";
+ const wchar_t kMakeChromeDefaultForUser[] = L"make_chrome_default_for_user";
+ const wchar_t kMsi[] = L"msi";
+ const wchar_t kRequireEula[] = L"require_eula";
+ const wchar_t kSystemLevel[] = L"system_level";
+ const wchar_t kVerboseLogging[] = L"verbose_logging";
+ const wchar_t kExtensionsBlock[] = L"extensions.settings";
+}
+}
diff --git a/chrome/installer/util/master_preferences_constants.h b/chrome/installer/util/master_preferences_constants.h
new file mode 100644
index 0000000..5bcd5d3
--- /dev/null
+++ b/chrome/installer/util/master_preferences_constants.h
@@ -0,0 +1,64 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// This file contains the constants used to process master_preferences files
+// used by setup and first run.
+
+#ifndef CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_CONSTANTS_H_
+#define CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_CONSTANTS_H_
+
+namespace installer_util {
+namespace master_preferences {
+// All the preferences below are expected to be inside the JSON "distribution"
+// block. Some of them also have equivalent command line option. If same option
+// is specified in master preference as well as command line, the commnd line
+// value takes precedence.
+
+// Boolean. Use alternate text for the shortcut. Cmd line override present.
+extern const wchar_t kAltShortcutText[];
+// Boolean. Use alternate smaller first run info bubble.
+extern const wchar_t kAltFirstRunBubble[];
+// Integer. Icon index from chrome.exe to use for shortcuts.
+extern const wchar_t kChromeShortcutIconIndex[];
+// Boolean. Create Desktop and QuickLaunch shortcuts. Cmd line override present.
+extern const wchar_t kCreateAllShortcuts[];
+// Boolean pref that triggers silent import of the default browser bookmarks.
+extern const wchar_t kDistroImportBookmarksPref[];
+// Boolean pref that triggers silent import of the default browser history.
+extern const wchar_t kDistroImportHistoryPref[];
+// Boolean pref that triggers silent import of the default browser homepage.
+extern const wchar_t kDistroImportHomePagePref[];
+// Boolean pref that triggers silent import of the default search engine.
+extern const wchar_t kDistroImportSearchPref[];
+// Integer. RLZ ping delay in seconds.
+extern const wchar_t kDistroPingDelay[];
+// Boolean pref that triggers loading the welcome page.
+extern const wchar_t kDistroShowWelcomePage[];
+// Boolean pref that triggers skipping the first run dialogs.
+extern const wchar_t kDistroSkipFirstRunPref[];
+// Boolean. Do not create Chrome desktop shortcuts. Cmd line override present.
+extern const wchar_t kDoNotCreateShortcuts[];
+// Boolean. Do not launch Chrome after first install. Cmd line override present.
+extern const wchar_t kDoNotLaunchChrome[];
+// Boolean. Do not register with Google Update to have Chrome launched after
+// install. Cmd line override present.
+extern const wchar_t kDoNotRegisterForUpdateLaunch[];
+// Boolean. Register Chrome as default browser. Cmd line override present.
+extern const wchar_t kMakeChromeDefault[];
+// Boolean. Register Chrome as default browser for the current user.
+extern const wchar_t kMakeChromeDefaultForUser[];
+// Boolean. Expect to be run by an MSI installer. Cmd line override present.
+extern const wchar_t kMsi[];
+// Boolean. Show EULA dialog before install.
+extern const wchar_t kRequireEula[];
+// Boolean. Install Chrome to system wise location. Cmd line override present.
+extern const wchar_t kSystemLevel[];
+// Boolean. Run installer in verbose mode. Cmd line override present.
+extern const wchar_t kVerboseLogging[];
+// Name of the block that contains the extensions on the master preferences.
+extern const wchar_t kExtensionsBlock[];
+}
+}
+
+#endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_CONSTANTS_H_
diff --git a/chrome/installer/util/master_preferences_dummy.cc b/chrome/installer/util/master_preferences_dummy.cc
new file mode 100644
index 0000000..9abd037
--- /dev/null
+++ b/chrome/installer/util/master_preferences_dummy.cc
@@ -0,0 +1,68 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// This file defines dummy implementation of several functions from the
+// master_preferences namespace for Google Chrome. These functions allow 64-bit
+// Windows Chrome binary to build successfully. Since this binary is only used
+// for Native Client support which uses the 32 bit installer, most of the
+// master preferences functionality is not actually needed.
+
+#include "chrome/installer/util/master_preferences.h"
+
+#include <windows.h>
+
+#include "base/logging.h"
+#include "googleurl/src/gurl.h"
+
+namespace installer_util {
+
+bool GetDistroBooleanPreference(const DictionaryValue* prefs,
+ const std::wstring& name,
+ bool* value) {
+ NOTREACHED();
+ return false;
+}
+
+bool GetDistroIntegerPreference(const DictionaryValue* prefs,
+ const std::wstring& name,
+ int* value) {
+ NOTREACHED();
+ return false;
+}
+
+DictionaryValue* GetInstallPreferences(const CommandLine& cmd_line) {
+ NOTREACHED();
+ return NULL;
+}
+
+DictionaryValue* ParseDistributionPreferences(
+ const FilePath& master_prefs_path) {
+ NOTREACHED();
+ return NULL;
+}
+
+std::vector<GURL> GetFirstRunTabs(const DictionaryValue* prefs) {
+ NOTREACHED();
+ return std::vector<GURL>();
+}
+
+std::vector<GURL> GetDefaultBookmarks(const DictionaryValue* prefs) {
+ NOTREACHED();
+ return std::vector<GURL>();
+}
+
+bool SetDistroBooleanPreference(DictionaryValue* prefs,
+ const std::wstring& name,
+ bool value) {
+ NOTREACHED();
+ return false;
+}
+
+bool HasExtensionsBlock(const DictionaryValue* prefs,
+ DictionaryValue** extensions) {
+ NOTREACHED();
+ return false;
+}
+
+}
diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc
index 3b7550a..65fcc6d 100644
--- a/chrome/installer/util/master_preferences_unittest.cc
+++ b/chrome/installer/util/master_preferences_unittest.cc
@@ -243,3 +243,81 @@ TEST(MasterPrefsExtension, ValidateExtensionJSON) {
EXPECT_TRUE(extensions->GetString(
L"behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.version", &version));
}
+
+// Test that we are parsing master preferences correctly.
+TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) {
+ // Create a temporary prefs file.
+ FilePath prefs_file;
+ ASSERT_TRUE(file_util::CreateTemporaryFile(&prefs_file));
+ const char text[] =
+ "{ \n"
+ " \"distribution\": { \n"
+ " \"skip_first_run_ui\": true,\n"
+ " \"create_all_shortcuts\": false,\n"
+ " \"do_not_launch_chrome\": true,\n"
+ " \"system_level\": true,\n"
+ " \"verbose_logging\": false\n"
+ " }\n"
+ "} \n";
+ EXPECT_TRUE(file_util::WriteFile(prefs_file, text, sizeof(text)));
+
+ // Make sure command line values override the values in master preferences.
+ std::wstring cmd_str(
+ L"setup.exe --installerdata=\"" + prefs_file.value() + L"\"");
+ cmd_str.append(L" --create-all-shortcuts");
+ cmd_str.append(L" --do-not-launch-chrome");
+ cmd_str.append(L" --alt-desktop-shortcut");
+ CommandLine cmd_line = CommandLine::FromString(cmd_str);
+ scoped_ptr<DictionaryValue> prefs(
+ installer_util::GetInstallPreferences(cmd_line));
+ EXPECT_TRUE(prefs.get() != NULL);
+
+ // Check prefs that do not have any equivalent command line option.
+ bool value = false;
+ EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kDistroSkipFirstRunPref, &value) &&
+ value);
+ EXPECT_FALSE(installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kDistroShowWelcomePage, &value));
+
+ // Now check that prefs got merged correctly.
+ EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kCreateAllShortcuts, &value) &&
+ value);
+ EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kDoNotLaunchChrome, &value) &&
+ value);
+ EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kAltShortcutText, &value) &&
+ value);
+ EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kSystemLevel, &value) &&
+ value);
+ EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kVerboseLogging, &value));
+ EXPECT_FALSE(value);
+
+ // Delete temporary prefs file.
+ EXPECT_TRUE(file_util::Delete(prefs_file, false));
+
+ // Check that if master prefs doesn't exist, we can still parse the common
+ // prefs.
+ cmd_str = L"setup.exe --create-all-shortcuts --do-not-launch-chrome"
+ L" --alt-desktop-shortcut";
+ cmd_line.ParseFromString(cmd_str);
+ prefs.reset(installer_util::GetInstallPreferences(cmd_line));
+ EXPECT_TRUE(prefs.get() != NULL);
+ EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kCreateAllShortcuts, &value) &&
+ value);
+ EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kDoNotLaunchChrome, &value) &&
+ value);
+ EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kAltShortcutText, &value) &&
+ value);
+ EXPECT_FALSE(installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kSystemLevel, &value));
+ EXPECT_FALSE(installer_util::GetDistroBooleanPreference(prefs.get(),
+ installer_util::master_preferences::kVerboseLogging, &value));
+}
diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc
index 261863d..5980992 100644
--- a/chrome/installer/util/util_constants.cc
+++ b/chrome/installer/util/util_constants.cc
@@ -132,6 +132,7 @@ const wchar_t kInstallerDir[] = L"Installer";
const wchar_t kSxSSuffix[] = L" SxS";
const wchar_t kUninstallStringField[] = L"UninstallString";
+const wchar_t kUninstallArgumentsField[] = L"UninstallArguments";
const wchar_t kUninstallDisplayNameField[] = L"DisplayName";
const wchar_t kUninstallMetricsName[] = L"uninstall_metrics";
const wchar_t kUninstallInstallationDate[] = L"installation_date";
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h
index 7c0db12..1b8207e 100644
--- a/chrome/installer/util/util_constants.h
+++ b/chrome/installer/util/util_constants.h
@@ -98,6 +98,7 @@ extern const wchar_t kInstallerDir[];
extern const wchar_t kSxSSuffix[];
extern const wchar_t kUninstallStringField[];
+extern const wchar_t kUninstallArgumentsField[];
extern const wchar_t kUninstallDisplayNameField[];
extern const wchar_t kUninstallMetricsName[];
extern const wchar_t kUninstallInstallationDate[];