From befe84bbceb40e25af72c21aa6f8492d1eb7ae84 Mon Sep 17 00:00:00 2001 From: "robertshield@chromium.org" Date: Tue, 14 Dec 2010 20:23:49 +0000 Subject: Merge the installer, installer_util and setup_util namespaces into a single installer namespace. BUG=61609 TEST=NONE Review URL: http://codereview.chromium.org/5729004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69165 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/installer/util/browser_distribution.cc | 34 +++--- chrome/installer/util/browser_distribution.h | 14 +-- .../util/browser_distribution_unittest.cc | 4 +- chrome/installer/util/channel_info.cc | 4 +- chrome/installer/util/channel_info.h | 4 +- chrome/installer/util/channel_info_unittest.cc | 8 +- chrome/installer/util/chrome_frame_distribution.cc | 28 ++--- chrome/installer/util/chrome_frame_distribution.h | 6 +- .../installer/util/google_chrome_distribution.cc | 46 ++++---- chrome/installer/util/google_chrome_distribution.h | 6 +- .../util/google_chrome_distribution_dummy.cc | 6 +- .../util/google_chrome_distribution_unittest.cc | 4 +- .../util/google_chrome_sxs_distribution.cc | 10 +- .../util/google_chrome_sxs_distribution.h | 4 +- chrome/installer/util/google_update_settings.cc | 6 +- chrome/installer/util/google_update_settings.h | 4 +- .../util/google_update_settings_unittest.cc | 18 +-- chrome/installer/util/helper.cc | 4 +- chrome/installer/util/install_util.cc | 14 +-- chrome/installer/util/l10n_string_util.cc | 8 +- chrome/installer/util/l10n_string_util.h | 4 +- chrome/installer/util/language_selector.cc | 4 +- chrome/installer/util/language_selector.h | 4 +- .../installer/util/language_selector_unittest.cc | 10 +- chrome/installer/util/logging_installer.cc | 10 +- chrome/installer/util/logging_installer.h | 6 +- chrome/installer/util/master_preferences.cc | 74 ++++++------ chrome/installer/util/master_preferences.h | 4 +- .../installer/util/master_preferences_constants.cc | 4 +- .../installer/util/master_preferences_constants.h | 4 +- chrome/installer/util/master_preferences_dummy.cc | 2 +- .../installer/util/master_preferences_unittest.cc | 128 ++++++++++----------- chrome/installer/util/package.cc | 4 +- chrome/installer/util/package_unittest.cc | 6 +- chrome/installer/util/product.cc | 26 ++--- chrome/installer/util/product.h | 8 +- chrome/installer/util/product_unittest.cc | 18 +-- chrome/installer/util/shell_util.cc | 16 +-- chrome/installer/util/shell_util_unittest.cc | 2 +- chrome/installer/util/util_constants.cc | 4 +- chrome/installer/util/util_constants.h | 4 +- 41 files changed, 287 insertions(+), 287 deletions(-) (limited to 'chrome/installer/util') diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index 933a783..98b2e64 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -37,7 +37,7 @@ bool IsChromeFrameModule() { FilePath module_path; PathService::Get(base::FILE_MODULE, &module_path); return FilePath::CompareEqualIgnoreCase(module_path.BaseName().value(), - installer_util::kChromeFrameDll); + installer::kChromeFrameDll); } // Returns true if currently running in ceee_broker.exe @@ -45,7 +45,7 @@ bool IsCeeeBrokerProcess() { FilePath exe_path; PathService::Get(base::FILE_EXE, &exe_path); return FilePath::CompareEqualIgnoreCase(exe_path.BaseName().value(), - installer_util::kCeeeBrokerExe); + installer::kCeeeBrokerExe); } BrowserDistribution::Type GetCurrentDistributionType() { @@ -59,13 +59,13 @@ BrowserDistribution::Type GetCurrentDistributionType() { } // end namespace BrowserDistribution::BrowserDistribution( - const installer_util::MasterPreferences& prefs) + const installer::MasterPreferences& prefs) : type_(BrowserDistribution::CHROME_BROWSER) { } template BrowserDistribution* BrowserDistribution::GetOrCreateBrowserDistribution( - const installer_util::MasterPreferences& prefs, + const installer::MasterPreferences& prefs, BrowserDistribution** dist) { if (!*dist) { DistributionClass* temp = new DistributionClass(prefs); @@ -79,15 +79,15 @@ BrowserDistribution* BrowserDistribution::GetOrCreateBrowserDistribution( } BrowserDistribution* BrowserDistribution::GetDistribution() { - const installer_util::MasterPreferences& prefs = - installer_util::MasterPreferences::ForCurrentProcess(); + const installer::MasterPreferences& prefs = + installer::MasterPreferences::ForCurrentProcess(); return GetSpecificDistribution(GetCurrentDistributionType(), prefs); } // static BrowserDistribution* BrowserDistribution::GetSpecificDistribution( BrowserDistribution::Type type, - const installer_util::MasterPreferences& prefs) { + const installer::MasterPreferences& prefs) { BrowserDistribution* dist = NULL; if (type == CHROME_FRAME) { @@ -151,18 +151,18 @@ std::wstring BrowserDistribution::GetAppDescription() { std::wstring BrowserDistribution::GetLongAppDescription() { const std::wstring& app_description = - installer_util::GetLocalizedString(IDS_PRODUCT_DESCRIPTION_BASE); + installer::GetLocalizedString(IDS_PRODUCT_DESCRIPTION_BASE); return app_description; } // static int BrowserDistribution::GetInstallReturnCode( - installer_util::InstallStatus status) { + installer::InstallStatus status) { switch (status) { - case installer_util::FIRST_INSTALL_SUCCESS: - case installer_util::INSTALL_REPAIRED: - case installer_util::NEW_VERSION_UPDATED: - case installer_util::IN_USE_UPDATED: + case installer::FIRST_INSTALL_SUCCESS: + case installer::INSTALL_REPAIRED: + case installer::NEW_VERSION_UPDATED: + case installer::IN_USE_UPDATED: return 0; default: return status; @@ -214,11 +214,11 @@ bool BrowserDistribution::GetChromeChannel(std::wstring* channel) { } void BrowserDistribution::UpdateDiffInstallStatus(bool system_install, - bool incremental_install, installer_util::InstallStatus install_status) { + bool incremental_install, installer::InstallStatus install_status) { } void BrowserDistribution::LaunchUserExperiment( - installer_util::InstallStatus status, const installer::Version& version, + installer::InstallStatus status, const installer::Version& version, const installer::Product& installation, bool system_level) { } @@ -229,7 +229,7 @@ void BrowserDistribution::InactiveUserToastExperiment(int flavor, std::vector BrowserDistribution::GetKeyFiles() { std::vector key_files; - key_files.push_back(FilePath(installer_util::kChromeDll)); + key_files.push_back(FilePath(installer::kChromeDll)); return key_files; } @@ -240,5 +240,5 @@ std::vector BrowserDistribution::GetComDllList() { void BrowserDistribution::AppendUninstallCommandLineFlags( CommandLine* cmd_line) { DCHECK(cmd_line); - cmd_line->AppendSwitch(installer_util::switches::kChrome); + cmd_line->AppendSwitch(installer::switches::kChrome); } diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h index a4436bff..2b23169 100644 --- a/chrome/installer/util/browser_distribution.h +++ b/chrome/installer/util/browser_distribution.h @@ -25,7 +25,7 @@ class CommandLine; namespace installer { class Product; } -namespace installer_util { +namespace installer { class MasterPreferences; } @@ -41,11 +41,11 @@ class BrowserDistribution { static BrowserDistribution* GetDistribution(); static BrowserDistribution* GetSpecificDistribution( - Type type, const installer_util::MasterPreferences& prefs); + Type type, const installer::MasterPreferences& prefs); Type GetType() const { return type_; } - static int GetInstallReturnCode(installer_util::InstallStatus install_status); + static int GetInstallReturnCode(installer::InstallStatus install_status); virtual void DoPostUninstallOperations(const installer::Version& version, const FilePath& local_data_path, @@ -94,12 +94,12 @@ class BrowserDistribution { virtual bool GetChromeChannel(std::wstring* channel); virtual void UpdateDiffInstallStatus(bool system_install, - bool incremental_install, installer_util::InstallStatus install_status); + bool incremental_install, installer::InstallStatus install_status); // After an install or upgrade the user might qualify to participate in an // experiment. This function determines if the user qualifies and if so it // sets the wheels in motion or in simple cases does the experiment itself. - virtual void LaunchUserExperiment(installer_util::InstallStatus status, + virtual void LaunchUserExperiment(installer::InstallStatus status, const installer::Version& version, const installer::Product& installation, bool system_level); @@ -128,11 +128,11 @@ class BrowserDistribution { virtual void AppendUninstallCommandLineFlags(CommandLine* cmd_line); protected: - explicit BrowserDistribution(const installer_util::MasterPreferences& prefs); + explicit BrowserDistribution(const installer::MasterPreferences& prefs); template static BrowserDistribution* GetOrCreateBrowserDistribution( - const installer_util::MasterPreferences& prefs, + const installer::MasterPreferences& prefs, BrowserDistribution** dist); Type type_; diff --git a/chrome/installer/util/browser_distribution_unittest.cc b/chrome/installer/util/browser_distribution_unittest.cc index ac6b399..f35ad3f 100644 --- a/chrome/installer/util/browser_distribution_unittest.cc +++ b/chrome/installer/util/browser_distribution_unittest.cc @@ -33,8 +33,8 @@ TEST(BrowserDistributionTest, StringsTest) { { BrowserDistribution::CHROME_FRAME, true }, }; - const installer_util::MasterPreferences& prefs = - installer_util::MasterPreferences::ForCurrentProcess(); + const installer::MasterPreferences& prefs = + installer::MasterPreferences::ForCurrentProcess(); for (int i = 0; i < arraysize(browser_tests); ++i) { BrowserDistribution* dist = diff --git a/chrome/installer/util/channel_info.cc b/chrome/installer/util/channel_info.cc index 4025cb9..4acc4d4 100644 --- a/chrome/installer/util/channel_info.cc +++ b/chrome/installer/util/channel_info.cc @@ -31,7 +31,7 @@ const wchar_t* const kModifiers[] = { } // namespace -namespace installer_util { +namespace installer { // static bool ChannelInfo::HasModifier(const wchar_t* modifier, @@ -125,4 +125,4 @@ bool ChannelInfo::SetMultiInstall(bool value) { return SetModifier(kModMultiInstall, value, &value_); } -} // namespace installer_util +} // namespace installer diff --git a/chrome/installer/util/channel_info.h b/chrome/installer/util/channel_info.h index bfee20f..5ba919a 100644 --- a/chrome/installer/util/channel_info.h +++ b/chrome/installer/util/channel_info.h @@ -14,7 +14,7 @@ class RegKey; } } -namespace installer_util { +namespace installer { // A helper class for parsing and modifying the Omaha additional parameter // ("ap") client state value for a product. @@ -68,6 +68,6 @@ class ChannelInfo { std::wstring value_; }; // class ChannelInfo -} // namespace installer_util +} // namespace installer #endif // CHROME_INSTALLER_UTIL_CHANNEL_INFO_H_ diff --git a/chrome/installer/util/channel_info_unittest.cc b/chrome/installer/util/channel_info_unittest.cc index ac3350e..f5ea4bb 100644 --- a/chrome/installer/util/channel_info_unittest.cc +++ b/chrome/installer/util/channel_info_unittest.cc @@ -14,7 +14,7 @@ const std::wstring kChannelDev(L"dev"); } // namespace TEST(ChannelInfoTest, Channels) { - installer_util::ChannelInfo ci; + installer::ChannelInfo ci; std::wstring channel; ci.set_value(L""); @@ -55,7 +55,7 @@ TEST(ChannelInfoTest, Channels) { } TEST(ChannelInfoTest, CEEE) { - installer_util::ChannelInfo ci; + installer::ChannelInfo ci; ci.set_value(L""); EXPECT_TRUE(ci.SetCeee(true)); @@ -87,7 +87,7 @@ TEST(ChannelInfoTest, CEEE) { } TEST(ChannelInfoTest, FullInstall) { - installer_util::ChannelInfo ci; + installer::ChannelInfo ci; ci.set_value(L""); EXPECT_TRUE(ci.SetFullInstall(true)); @@ -119,7 +119,7 @@ TEST(ChannelInfoTest, FullInstall) { } TEST(ChannelInfoTest, MultiInstall) { - installer_util::ChannelInfo ci; + installer::ChannelInfo ci; ci.set_value(L""); EXPECT_TRUE(ci.SetMultiInstall(true)); diff --git a/chrome/installer/util/chrome_frame_distribution.cc b/chrome/installer/util/chrome_frame_distribution.cc index 02ec281..49c8827 100644 --- a/chrome/installer/util/chrome_frame_distribution.cc +++ b/chrome/installer/util/chrome_frame_distribution.cc @@ -24,7 +24,7 @@ const wchar_t kChromeFrameGuid[] = L"{8BA986DA-5100-405E-AA35-86F34A02ACBF}"; } ChromeFrameDistribution::ChromeFrameDistribution( - const installer_util::MasterPreferences& prefs) + const installer::MasterPreferences& prefs) : BrowserDistribution(prefs) { type_ = BrowserDistribution::CHROME_FRAME; ceee_ = prefs.install_ceee(); @@ -36,13 +36,13 @@ std::wstring ChromeFrameDistribution::GetAppGuid() { std::wstring ChromeFrameDistribution::GetApplicationName() { const std::wstring& product_name = - installer_util::GetLocalizedString(IDS_PRODUCT_FRAME_NAME_BASE); + installer::GetLocalizedString(IDS_PRODUCT_FRAME_NAME_BASE); return product_name; } std::wstring ChromeFrameDistribution::GetAlternateApplicationName() { const std::wstring& product_name = - installer_util::GetLocalizedString(IDS_PRODUCT_FRAME_NAME_BASE); + installer::GetLocalizedString(IDS_PRODUCT_FRAME_NAME_BASE); return product_name; } @@ -52,7 +52,7 @@ std::wstring ChromeFrameDistribution::GetInstallSubDir() { std::wstring ChromeFrameDistribution::GetPublisherName() { const std::wstring& publisher_name = - installer_util::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE); + installer::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE); return publisher_name; } @@ -107,7 +107,7 @@ bool ChromeFrameDistribution::CanSetAsDefault() { } void ChromeFrameDistribution::UpdateDiffInstallStatus(bool system_install, - bool incremental_install, installer_util::InstallStatus install_status) { + bool incremental_install, installer::InstallStatus install_status) { GoogleUpdateSettings::UpdateDiffInstallStatus(system_install, incremental_install, GetInstallReturnCode(install_status), kChromeFrameGuid); @@ -115,20 +115,20 @@ void ChromeFrameDistribution::UpdateDiffInstallStatus(bool system_install, std::vector ChromeFrameDistribution::GetKeyFiles() { std::vector key_files; - key_files.push_back(FilePath(installer_util::kChromeFrameDll)); + key_files.push_back(FilePath(installer::kChromeFrameDll)); if (ceee_) { - key_files.push_back(FilePath(installer_util::kCeeeIeDll)); - key_files.push_back(FilePath(installer_util::kCeeeBrokerExe)); + key_files.push_back(FilePath(installer::kCeeeIeDll)); + key_files.push_back(FilePath(installer::kCeeeBrokerExe)); } return key_files; } std::vector ChromeFrameDistribution::GetComDllList() { std::vector dll_list; - dll_list.push_back(FilePath(installer_util::kChromeFrameDll)); + dll_list.push_back(FilePath(installer::kChromeFrameDll)); if (ceee_) { - dll_list.push_back(FilePath(installer_util::kCeeeInstallHelperDll)); - dll_list.push_back(FilePath(installer_util::kCeeeIeDll)); + dll_list.push_back(FilePath(installer::kCeeeInstallHelperDll)); + dll_list.push_back(FilePath(installer::kCeeeIeDll)); } return dll_list; } @@ -136,9 +136,9 @@ std::vector ChromeFrameDistribution::GetComDllList() { void ChromeFrameDistribution::AppendUninstallCommandLineFlags( CommandLine* cmd_line) { DCHECK(cmd_line); - cmd_line->AppendSwitch(installer_util::switches::kDeleteProfile); - cmd_line->AppendSwitch(installer_util::switches::kChromeFrame); + cmd_line->AppendSwitch(installer::switches::kDeleteProfile); + cmd_line->AppendSwitch(installer::switches::kChromeFrame); if (ceee_) { - cmd_line->AppendSwitch(installer_util::switches::kCeee); + cmd_line->AppendSwitch(installer::switches::kCeee); } } diff --git a/chrome/installer/util/chrome_frame_distribution.h b/chrome/installer/util/chrome_frame_distribution.h index fdf9c28..6bf7e0f 100644 --- a/chrome/installer/util/chrome_frame_distribution.h +++ b/chrome/installer/util/chrome_frame_distribution.h @@ -14,7 +14,7 @@ #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/util_constants.h" -namespace installer_util { +namespace installer { class MasterPreferences; } @@ -54,7 +54,7 @@ class ChromeFrameDistribution : public BrowserDistribution { // Update ap value. We implement this simply to have the same behaviour re. // the ap value. virtual void UpdateDiffInstallStatus(bool system_install, - bool incremental_install, installer_util::InstallStatus install_status); + bool incremental_install, installer::InstallStatus install_status); virtual std::vector GetKeyFiles(); @@ -67,7 +67,7 @@ class ChromeFrameDistribution : public BrowserDistribution { // Disallow construction from non-friends. explicit ChromeFrameDistribution( - const installer_util::MasterPreferences& prefs); + const installer::MasterPreferences& prefs); // Determines whether this Chrome Frame distribution is being used to work // with CEEE bits as well. diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 31987f9..ef8e8b0 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -140,14 +140,14 @@ bool RelaunchSetup(const std::string& flag, int value, // Re-add the system level toast flag. if (system_level_toast) { - new_cmd_line.AppendSwitch(installer_util::switches::kSystemLevelToast); + new_cmd_line.AppendSwitch(installer::switches::kSystemLevelToast); // Re-add the toast result key. We need to do this because Setup running as // system passes the key to Setup running as user, but that child process // does not perform the actual toasting, it launches another Setup (as user) // to do so. That is the process that needs the key. const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess(); - std::string key(installer_util::switches::kToastResultsKey); + std::string key(installer::switches::kToastResultsKey); std::string toast_key = current_cmd_line.GetSwitchValueASCII(key); if (!toast_key.empty()) { new_cmd_line.AppendSwitchASCII(key, toast_key); @@ -225,7 +225,7 @@ bool RelaunchSetupAsConsoleUser(const std::string& flag) { // Get the Google Update results key, and pass it on the command line to // the child process. int key = GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey(); - cmd_line.AppendSwitchASCII(installer_util::switches::kToastResultsKey, + cmd_line.AppendSwitchASCII(installer::switches::kToastResultsKey, base::IntToString(key)); if (base::win::GetVersion() > base::win::VERSION_XP) { @@ -253,7 +253,7 @@ bool RelaunchSetupAsConsoleUser(const std::string& flag) { } // namespace GoogleChromeDistribution::GoogleChromeDistribution( - const installer_util::MasterPreferences& prefs) + const installer::MasterPreferences& prefs) : BrowserDistribution(prefs), product_guid_(kChromeGuid) { } @@ -310,8 +310,8 @@ bool GoogleChromeDistribution::ExtractUninstallMetrics( } DictionaryValue* uninstall_metrics_dict; - if (!root.HasKey(installer_util::kUninstallMetricsName) || - !root.GetDictionary(installer_util::kUninstallMetricsName, + if (!root.HasKey(installer::kUninstallMetricsName) || + !root.GetDictionary(installer::kUninstallMetricsName, &uninstall_metrics_dict)) { return false; } @@ -384,13 +384,13 @@ std::wstring GoogleChromeDistribution::GetAppGuid() { std::wstring GoogleChromeDistribution::GetApplicationName() { const std::wstring& product_name = - installer_util::GetLocalizedString(IDS_PRODUCT_NAME_BASE); + installer::GetLocalizedString(IDS_PRODUCT_NAME_BASE); return product_name; } std::wstring GoogleChromeDistribution::GetAlternateApplicationName() { const std::wstring& alt_product_name = - installer_util::GetLocalizedString(IDS_OEM_MAIN_SHORTCUT_NAME_BASE); + installer::GetLocalizedString(IDS_OEM_MAIN_SHORTCUT_NAME_BASE); return alt_product_name; } @@ -399,21 +399,21 @@ std::wstring GoogleChromeDistribution::GetBrowserAppId() { } std::wstring GoogleChromeDistribution::GetInstallSubDir() { - std::wstring sub_dir(installer_util::kGoogleChromeInstallSubDir1); + std::wstring sub_dir(installer::kGoogleChromeInstallSubDir1); sub_dir.append(L"\\"); - sub_dir.append(installer_util::kGoogleChromeInstallSubDir2); + sub_dir.append(installer::kGoogleChromeInstallSubDir2); return sub_dir; } std::wstring GoogleChromeDistribution::GetPublisherName() { const std::wstring& publisher_name = - installer_util::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE); + installer::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE); return publisher_name; } std::wstring GoogleChromeDistribution::GetAppDescription() { const std::wstring& app_description = - installer_util::GetLocalizedString(IDS_SHORTCUT_TOOLTIP_BASE); + installer::GetLocalizedString(IDS_SHORTCUT_TOOLTIP_BASE); return app_description; } @@ -477,7 +477,7 @@ std::wstring GoogleChromeDistribution::GetDistributionData(HKEY root_key) { std::wstring GoogleChromeDistribution::GetUninstallLinkName() { const std::wstring& link_name = - installer_util::GetLocalizedString(IDS_UNINSTALL_CHROME_BASE); + installer::GetLocalizedString(IDS_UNINSTALL_CHROME_BASE); return link_name; } @@ -502,7 +502,7 @@ std::wstring GoogleChromeDistribution::GetVersionKey() { // string (if it is present) regardless of whether installer failed or not. // There is no fall-back for full installer :) void GoogleChromeDistribution::UpdateDiffInstallStatus(bool system_install, - bool incremental_install, installer_util::InstallStatus install_status) { + bool incremental_install, installer::InstallStatus install_status) { GoogleUpdateSettings::UpdateDiffInstallStatus(system_install, incremental_install, GetInstallReturnCode(install_status), product_guid().c_str()); @@ -522,10 +522,10 @@ void SetClient(std::wstring experiment_group, bool last_write) { // passed in to the command line (such as for system level installs), we use // it. Otherwise, we write to the key under HKCU. const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); - if (cmd_line.HasSwitch(installer_util::switches::kToastResultsKey)) { + if (cmd_line.HasSwitch(installer::switches::kToastResultsKey)) { // Get the handle to the key under HKLM. base::StringToInt(cmd_line.GetSwitchValueASCII( - installer_util::switches::kToastResultsKey).c_str(), + installer::switches::kToastResultsKey).c_str(), ®_key_handle); } else { reg_key_handle = 0; @@ -553,17 +553,17 @@ void SetClient(std::wstring experiment_group, bool last_write) { // 3- It has been re-launched from the #2 case. In this case we enter // this function with |system_install| true and a REENTRY_SYS_UPDATE status. void GoogleChromeDistribution::LaunchUserExperiment( - installer_util::InstallStatus status, const installer::Version& version, + installer::InstallStatus status, const installer::Version& version, const installer::Product& installation, bool system_level) { if (system_level) { - if (installer_util::NEW_VERSION_UPDATED == status) { + if (installer::NEW_VERSION_UPDATED == status) { // We need to relaunch as the interactive user. - RelaunchSetupAsConsoleUser(installer_util::switches::kSystemLevelToast); + RelaunchSetupAsConsoleUser(installer::switches::kSystemLevelToast); return; } } else { - if ((installer_util::NEW_VERSION_UPDATED != status) && - (installer_util::REENTRY_SYS_UPDATE != status)) { + if ((installer::NEW_VERSION_UPDATED != status) && + (installer::REENTRY_SYS_UPDATE != status)) { // We are not updating or in re-launch. Exit. return; } @@ -615,7 +615,7 @@ void GoogleChromeDistribution::LaunchUserExperiment( // because google_update expects the upgrade process to be quick and nimble. // System level: We have already been relaunched, so we don't need to be // quick, but we relaunch to follow the exact same codepath. - RelaunchSetup(installer_util::switches::kInactiveUserToast, flavor, + RelaunchSetup(installer::switches::kInactiveUserToast, flavor, system_level); } @@ -668,7 +668,7 @@ void GoogleChromeDistribution::InactiveUserToastExperiment(int flavor, // we waited for chrome to exit so the uninstall would not detect chrome // running. bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( - installer_util::switches::kSystemLevelToast); + installer::switches::kSystemLevelToast); std::wstring cmd(InstallUtil::GetChromeUninstallCmd( system_level_toast, this)); diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h index 9a84b94..6dd0f6b 100644 --- a/chrome/installer/util/google_chrome_distribution.h +++ b/chrome/installer/util/google_chrome_distribution.h @@ -66,9 +66,9 @@ class GoogleChromeDistribution : public BrowserDistribution { virtual std::wstring GetVersionKey(); virtual void UpdateDiffInstallStatus(bool system_install, - bool incremental_install, installer_util::InstallStatus install_status); + bool incremental_install, installer::InstallStatus install_status); - virtual void LaunchUserExperiment(installer_util::InstallStatus status, + virtual void LaunchUserExperiment(installer::InstallStatus status, const installer::Version& version, const installer::Product& installation, bool system_level); @@ -86,7 +86,7 @@ class GoogleChromeDistribution : public BrowserDistribution { // Disallow construction from others. explicit GoogleChromeDistribution( - const installer_util::MasterPreferences& prefs); + const installer::MasterPreferences& prefs); private: friend class BrowserDistribution; diff --git a/chrome/installer/util/google_chrome_distribution_dummy.cc b/chrome/installer/util/google_chrome_distribution_dummy.cc index 9d6d6d5..648bfbf 100644 --- a/chrome/installer/util/google_chrome_distribution_dummy.cc +++ b/chrome/installer/util/google_chrome_distribution_dummy.cc @@ -15,7 +15,7 @@ #include "base/logging.h" GoogleChromeDistribution::GoogleChromeDistribution( - const installer_util::MasterPreferences& prefs) + const installer::MasterPreferences& prefs) : BrowserDistribution(prefs) { } @@ -101,12 +101,12 @@ std::wstring GoogleChromeDistribution::GetVersionKey() { } void GoogleChromeDistribution::UpdateDiffInstallStatus(bool system_install, - bool incremental_install, installer_util::InstallStatus install_status) { + bool incremental_install, installer::InstallStatus install_status) { NOTREACHED(); } void GoogleChromeDistribution::LaunchUserExperiment( - installer_util::InstallStatus status, const installer::Version& version, + installer::InstallStatus status, const installer::Version& version, const installer::Product& installation, bool system_level) { NOTREACHED(); } diff --git a/chrome/installer/util/google_chrome_distribution_unittest.cc b/chrome/installer/util/google_chrome_distribution_unittest.cc index ee5ce89..1222ff3 100644 --- a/chrome/installer/util/google_chrome_distribution_unittest.cc +++ b/chrome/installer/util/google_chrome_distribution_unittest.cc @@ -52,8 +52,8 @@ TEST(GoogleChromeDistTest, TestExtractUninstallMetrics) { ASSERT_TRUE(root.get()); std::wstring uninstall_metrics_string; - const installer_util::MasterPreferences& prefs = - installer_util::MasterPreferences::ForCurrentProcess(); + const installer::MasterPreferences& prefs = + installer::MasterPreferences::ForCurrentProcess(); GoogleChromeDistribution* dist = static_cast( BrowserDistribution::GetSpecificDistribution( diff --git a/chrome/installer/util/google_chrome_sxs_distribution.cc b/chrome/installer/util/google_chrome_sxs_distribution.cc index 0adfd95..9461a52 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.cc +++ b/chrome/installer/util/google_chrome_sxs_distribution.cc @@ -21,14 +21,14 @@ const int kSxSIconIndex = 4; } // namespace GoogleChromeSxSDistribution::GoogleChromeSxSDistribution( - const installer_util::MasterPreferences& prefs) + const installer::MasterPreferences& prefs) : GoogleChromeDistribution(prefs) { GoogleChromeDistribution::set_product_guid(kChromeSxSGuid); } std::wstring GoogleChromeSxSDistribution::GetAppShortCutName() { const std::wstring& shortcut_name = - installer_util::GetLocalizedString(IDS_SXS_SHORTCUT_NAME_BASE); + installer::GetLocalizedString(IDS_SXS_SHORTCUT_NAME_BASE); return shortcut_name; } @@ -38,12 +38,12 @@ std::wstring GoogleChromeSxSDistribution::GetBrowserAppId() { std::wstring GoogleChromeSxSDistribution::GetInstallSubDir() { return GoogleChromeDistribution::GetInstallSubDir().append( - installer_util::kSxSSuffix); + installer::kSxSSuffix); } std::wstring GoogleChromeSxSDistribution::GetUninstallRegPath() { return GoogleChromeDistribution::GetUninstallRegPath().append( - installer_util::kSxSSuffix); + installer::kSxSSuffix); } bool GoogleChromeSxSDistribution::CanSetAsDefault() { @@ -66,5 +66,5 @@ std::wstring GoogleChromeSxSDistribution::ChannelName() { void GoogleChromeSxSDistribution::AppendUninstallCommandLineFlags( CommandLine* cmd_line) { DCHECK(cmd_line); - cmd_line->AppendSwitch(installer_util::switches::kChromeSxS); + cmd_line->AppendSwitch(installer::switches::kChromeSxS); } diff --git a/chrome/installer/util/google_chrome_sxs_distribution.h b/chrome/installer/util/google_chrome_sxs_distribution.h index c007c1c..7088c56 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.h +++ b/chrome/installer/util/google_chrome_sxs_distribution.h @@ -11,7 +11,7 @@ #include "chrome/installer/util/l10n_string_util.h" #include "chrome/installer/util/util_constants.h" -namespace installer_util { +namespace installer { class MasterPreferences; } @@ -38,7 +38,7 @@ class GoogleChromeSxSDistribution : public GoogleChromeDistribution { // Disallow construction from non-friends. explicit GoogleChromeSxSDistribution( - const installer_util::MasterPreferences& prefs); + const installer::MasterPreferences& prefs); }; #endif // CHROME_INSTALLER_UTIL_GOOGLE_CHROME_SXS_DISTRIBUTION_H_ diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index e16e62a..2481cf4 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc @@ -165,7 +165,7 @@ bool GoogleUpdateSettings::GetChromeChannel(bool system_install, HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; std::wstring reg_path = dist->GetStateKey(); RegKey key(root_key, reg_path.c_str(), KEY_READ); - installer_util::ChannelInfo channel_info; + installer::ChannelInfo channel_info; if (!channel_info.Initialize(key)) { *channel = L"unknown"; return false; @@ -190,7 +190,7 @@ void GoogleUpdateSettings::UpdateDiffInstallStatus(bool system_install, HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; RegKey key; - installer_util::ChannelInfo channel_info; + installer::ChannelInfo channel_info; std::wstring reg_key(google_update::kRegPathClientState); reg_key.append(L"\\"); reg_key.append(product_guid); @@ -223,7 +223,7 @@ void GoogleUpdateSettings::UpdateDiffInstallStatus(bool system_install, bool GoogleUpdateSettings::UpdateGoogleUpdateApKey( bool diff_install, int install_return_code, - installer_util::ChannelInfo* value) { + installer::ChannelInfo* value) { if (!diff_install || !install_return_code) { if (value->SetFullInstall(false)) { VLOG(1) << "Removed incremental installer failure key; new value: " diff --git a/chrome/installer/util/google_update_settings.h b/chrome/installer/util/google_update_settings.h index e1b8fbb..3f53c5e 100644 --- a/chrome/installer/util/google_update_settings.h +++ b/chrome/installer/util/google_update_settings.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" -namespace installer_util { +namespace installer { class ChannelInfo; } @@ -108,7 +108,7 @@ class GoogleUpdateSettings { // Returns true if |value| is modified. static bool UpdateGoogleUpdateApKey(bool diff_install, int install_return_code, - installer_util::ChannelInfo* value); + installer::ChannelInfo* value); // For system-level installs, we need to be able to communicate the results // of the Toast Experiments back to Google Update. The problem is just that diff --git a/chrome/installer/util/google_update_settings_unittest.cc b/chrome/installer/util/google_update_settings_unittest.cc index 519a1c8..9fe82e9 100644 --- a/chrome/installer/util/google_update_settings_unittest.cc +++ b/chrome/installer/util/google_update_settings_unittest.cc @@ -213,11 +213,11 @@ TEST_F(GoogleUpdateSettingsTest, CurrentChromeChannelVariousApValuesUser) { } TEST_F(GoogleUpdateSettingsTest, UpdateGoogleUpdateApKey) { - installer_util::InstallStatus s = installer_util::FIRST_INSTALL_SUCCESS; - installer_util::InstallStatus f = installer_util::INSTALL_FAILED; + installer::InstallStatus s = installer::FIRST_INSTALL_SUCCESS; + installer::InstallStatus f = installer::INSTALL_FAILED; // Incremental Installer that worked. - installer_util::ChannelInfo v; + installer::ChannelInfo v; v.set_value(L""); EXPECT_FALSE(GoogleUpdateSettings::UpdateGoogleUpdateApKey(true, s, &v)); EXPECT_EQ(v.value(), L""); @@ -324,7 +324,7 @@ TEST_F(GoogleUpdateSettingsTest, UpdateDiffInstallStatusTest) { ASSERT_TRUE(CreateApKey(work_item_list.get(), L"")) << "Failed to create ap key."; GoogleUpdateSettings::UpdateDiffInstallStatus(false, true, - installer_util::INSTALL_FAILED, + installer::INSTALL_FAILED, kTestProductGuid); EXPECT_STREQ(ReadApKeyValue().c_str(), L"-full"); work_item_list->Rollback(); @@ -334,7 +334,7 @@ TEST_F(GoogleUpdateSettingsTest, UpdateDiffInstallStatusTest) { ASSERT_TRUE(CreateApKey(work_item_list.get(), L"")) << "Failed to create ap key."; GoogleUpdateSettings::UpdateDiffInstallStatus(false, true, - installer_util::FIRST_INSTALL_SUCCESS, + installer::FIRST_INSTALL_SUCCESS, kTestProductGuid); EXPECT_STREQ(ReadApKeyValue().c_str(), L""); work_item_list->Rollback(); @@ -344,7 +344,7 @@ TEST_F(GoogleUpdateSettingsTest, UpdateDiffInstallStatusTest) { ASSERT_TRUE(CreateApKey(work_item_list.get(), L"-full")) << "Failed to create ap key."; GoogleUpdateSettings::UpdateDiffInstallStatus(false, false, - installer_util::INSTALL_FAILED, + installer::INSTALL_FAILED, kTestProductGuid); EXPECT_STREQ(ReadApKeyValue().c_str(), L""); work_item_list->Rollback(); @@ -354,7 +354,7 @@ TEST_F(GoogleUpdateSettingsTest, UpdateDiffInstallStatusTest) { ASSERT_TRUE(CreateApKey(work_item_list.get(), L"-full")) << "Failed to create ap key."; GoogleUpdateSettings::UpdateDiffInstallStatus(false, false, - installer_util::FIRST_INSTALL_SUCCESS, + installer::FIRST_INSTALL_SUCCESS, kTestProductGuid); EXPECT_STREQ(ReadApKeyValue().c_str(), L""); work_item_list->Rollback(); @@ -374,12 +374,12 @@ TEST_F(GoogleUpdateSettingsTest, UpdateDiffInstallStatusTest) { } // try differential installer GoogleUpdateSettings::UpdateDiffInstallStatus(false, true, - installer_util::INSTALL_FAILED, + installer::INSTALL_FAILED, kTestProductGuid); EXPECT_STREQ(ReadApKeyValue().c_str(), L"-full"); // try full installer now GoogleUpdateSettings::UpdateDiffInstallStatus(false, false, - installer_util::INSTALL_FAILED, + installer::INSTALL_FAILED, kTestProductGuid); EXPECT_STREQ(ReadApKeyValue().c_str(), L""); // Now cleanup to leave the system in unchanged state. diff --git a/chrome/installer/util/helper.cc b/chrome/installer/util/helper.cc index b217a9a..d0151fd 100644 --- a/chrome/installer/util/helper.cc +++ b/chrome/installer/util/helper.cc @@ -33,10 +33,10 @@ FilePath GetChromeInstallBasePath(bool system, FilePath installer::GetChromeInstallPath(bool system_install, BrowserDistribution* dist) { return GetChromeInstallBasePath(system_install, dist, - installer_util::kInstallBinaryDir); + installer::kInstallBinaryDir); } FilePath installer::GetChromeUserDataPath(BrowserDistribution* dist) { return GetChromeInstallBasePath(false, dist, - installer_util::kInstallUserDataDir); + installer::kInstallUserDataDir); } diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index d18b1612..7d0d978 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -29,7 +29,7 @@ #include "chrome/installer/util/work_item_list.h" using base::win::RegKey; -using installer_util::MasterPreferences; +using installer::MasterPreferences; bool InstallUtil::ExecuteExeAsAdmin(const CommandLine& cmd, DWORD* exit_code) { FilePath::StringType program(cmd.GetProgram().value()); @@ -74,7 +74,7 @@ std::wstring InstallUtil::GetChromeUninstallCmd(bool system_install, HKEY root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; RegKey key(root, dist->GetUninstallRegPath().c_str(), KEY_READ); std::wstring uninstall_cmd; - key.ReadValue(installer_util::kUninstallStringField, &uninstall_cmd); + key.ReadValue(installer::kUninstallStringField, &uninstall_cmd); return uninstall_cmd; } @@ -121,7 +121,7 @@ bool InstallUtil::IsPerUserInstall(const wchar_t* const exe_path) { bool InstallUtil::IsChromeFrameProcess() { const MasterPreferences& prefs = - installer_util::MasterPreferences::ForCurrentProcess(); + installer::MasterPreferences::ForCurrentProcess(); return prefs.install_chrome_frame(); } @@ -129,16 +129,16 @@ bool CheckIsChromeSxSProcess() { CommandLine* command_line = CommandLine::ForCurrentProcess(); CHECK(command_line); - if (command_line->HasSwitch(installer_util::switches::kChromeSxS)) + if (command_line->HasSwitch(installer::switches::kChromeSxS)) return true; // Also return true if we are running from Chrome SxS installed path. FilePath exe_dir; PathService::Get(base::DIR_EXE, &exe_dir); - std::wstring chrome_sxs_dir(installer_util::kGoogleChromeInstallSubDir2); - chrome_sxs_dir.append(installer_util::kSxSSuffix); + std::wstring chrome_sxs_dir(installer::kGoogleChromeInstallSubDir2); + chrome_sxs_dir.append(installer::kSxSSuffix); return FilePath::CompareEqualIgnoreCase(exe_dir.BaseName().value(), - installer_util::kInstallBinaryDir) && + installer::kInstallBinaryDir) && FilePath::CompareEqualIgnoreCase(exe_dir.DirName().BaseName().value(), chrome_sxs_dir); } diff --git a/chrome/installer/util/l10n_string_util.cc b/chrome/installer/util/l10n_string_util.cc index ef30a01..b8429a8 100644 --- a/chrome/installer/util/l10n_string_util.cc +++ b/chrome/installer/util/l10n_string_util.cc @@ -14,15 +14,15 @@ namespace { -const installer_util::LanguageSelector& GetLanguageSelector() { - static const installer_util::LanguageSelector instance; +const installer::LanguageSelector& GetLanguageSelector() { + static const installer::LanguageSelector instance; return instance; } } // namespace -namespace installer_util { +namespace installer { std::wstring GetLocalizedString(int base_message_id) { std::wstring localized_string; @@ -75,4 +75,4 @@ std::wstring GetLocalizedEulaResource() { return url_path; } -} // namespace installer_util +} // namespace installer diff --git a/chrome/installer/util/l10n_string_util.h b/chrome/installer/util/l10n_string_util.h index 720655e..e4420d9 100644 --- a/chrome/installer/util/l10n_string_util.h +++ b/chrome/installer/util/l10n_string_util.h @@ -16,7 +16,7 @@ #include -namespace installer_util { +namespace installer { // Given a string base id, return the localized version of the string based on // the system language. This is used for shortcuts placed on the user's @@ -27,6 +27,6 @@ std::wstring GetLocalizedString(int base_message_id); // The empty string is returned on failure. std::wstring GetLocalizedEulaResource(); -} // namespace installer_util. +} // namespace installer. #endif // CHROME_INSTALLER_UTIL_L10N_STRING_UTIL_H_ diff --git a/chrome/installer/util/language_selector.cc b/chrome/installer/util/language_selector.cc index 8aa6fd6..d47998f 100644 --- a/chrome/installer/util/language_selector.cc +++ b/chrome/installer/util/language_selector.cc @@ -211,7 +211,7 @@ void GetCandidatesFromSystem(std::vector* candidates) { } // namespace -namespace installer_util { +namespace installer { LanguageSelector::LanguageSelector() : offset_(arraysize(kLanguageOffsetPairs)) { @@ -298,4 +298,4 @@ void LanguageSelector::DoSelect(const std::vector& candidates) { } } -} // namespace installer_util +} // namespace installer diff --git a/chrome/installer/util/language_selector.h b/chrome/installer/util/language_selector.h index 0085461c..957a431 100644 --- a/chrome/installer/util/language_selector.h +++ b/chrome/installer/util/language_selector.h @@ -14,7 +14,7 @@ #include "base/basictypes.h" -namespace installer_util { +namespace installer { // A helper class for selecting a supported language from a set of candidates. // By default, the candidates are retrieved from the operating system. @@ -55,6 +55,6 @@ class LanguageSelector { DISALLOW_COPY_AND_ASSIGN(LanguageSelector); }; -} // namespace installer_util. +} // namespace installer. #endif // CHROME_INSTALLER_UTIL_LANGUAGE_SELECTOR_H_ diff --git a/chrome/installer/util/language_selector_unittest.cc b/chrome/installer/util/language_selector_unittest.cc index fc6b72d7..1e5bc00 100644 --- a/chrome/installer/util/language_selector_unittest.cc +++ b/chrome/installer/util/language_selector_unittest.cc @@ -44,7 +44,7 @@ const wchar_t* const kWildcardMatchCandidates[] = { // Test that a language is selected from the system. TEST(LanguageSelectorTest, DefaultSelection) { - installer_util::LanguageSelector instance; + installer::LanguageSelector instance; EXPECT_FALSE(instance.matched_candidate().empty()); } @@ -54,7 +54,7 @@ TEST(LanguageSelectorTest, AssortedSelections) { std::wstring candidates[] = { L"fr-BE", L"fr", L"en" }; - installer_util::LanguageSelector instance( + installer::LanguageSelector instance( std::vector(&candidates[0], &candidates[arraysize(candidates)])); #if defined(GOOGLE_CHROME_BUILD) @@ -69,7 +69,7 @@ TEST(LanguageSelectorTest, AssortedSelections) { std::wstring candidates[] = { L"xx-YY", L"cc-Ssss-RR" }; - installer_util::LanguageSelector instance( + installer::LanguageSelector instance( std::vector(&candidates[0], &candidates[arraysize(candidates)])); // Expect the fallback to win. @@ -79,7 +79,7 @@ TEST(LanguageSelectorTest, AssortedSelections) { std::wstring candidates[] = { L"zh-SG", L"en-GB" }; - installer_util::LanguageSelector instance( + installer::LanguageSelector instance( std::vector(&candidates[0], &candidates[arraysize(candidates)])); #if defined(GOOGLE_CHROME_BUILD) @@ -98,7 +98,7 @@ class LanguageSelectorMatchCandidateTest }; TEST_P(LanguageSelectorMatchCandidateTest, TestMatchCandidate) { - installer_util::LanguageSelector instance( + installer::LanguageSelector instance( std::vector(1, std::wstring(GetParam()))); EXPECT_EQ(GetParam(), instance.matched_candidate()); } diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index e2bcd54..d91ca70 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -27,12 +27,12 @@ namespace installer { // InitInstallerLogging() and the beginning of EndInstallerLogging(). bool installer_logging_ = false; -void InitInstallerLogging(const installer_util::MasterPreferences& prefs) { +void InitInstallerLogging(const installer::MasterPreferences& prefs) { if (installer_logging_) return; bool value = false; - if (prefs.GetBool(installer_util::master_preferences::kDisableLogging, + if (prefs.GetBool(installer::master_preferences::kDisableLogging, &value) && value) { installer_logging_ = true; return; @@ -43,7 +43,7 @@ void InitInstallerLogging(const installer_util::MasterPreferences& prefs) { logging::LOCK_LOG_FILE, logging::DELETE_OLD_LOG_FILE); - if (prefs.GetBool(installer_util::master_preferences::kVerboseLogging, + if (prefs.GetBool(installer::master_preferences::kVerboseLogging, &value) && value) { logging::SetMinLogLevel(logging::LOG_VERBOSE); } else { @@ -62,9 +62,9 @@ void EndInstallerLogging() { installer_logging_ = false; } -FilePath GetLogFilePath(const installer_util::MasterPreferences& prefs) { +FilePath GetLogFilePath(const installer::MasterPreferences& prefs) { std::string path; - prefs.GetString(installer_util::master_preferences::kLogFile, &path); + prefs.GetString(installer::master_preferences::kLogFile, &path); if (!path.empty()) { return FilePath(UTF8ToWide(path)); } diff --git a/chrome/installer/util/logging_installer.h b/chrome/installer/util/logging_installer.h index 56495b6..d8c14c2 100644 --- a/chrome/installer/util/logging_installer.h +++ b/chrome/installer/util/logging_installer.h @@ -6,7 +6,7 @@ #define CHROME_INSTALLER_UTIL_LOGGING_INSTALLER_H_ #pragma once -namespace installer_util { +namespace installer { class MasterPreferences; } @@ -15,13 +15,13 @@ class FilePath; namespace installer { // Call to initialize logging for Chrome installer. -void InitInstallerLogging(const installer_util::MasterPreferences& prefs); +void InitInstallerLogging(const installer::MasterPreferences& prefs); // Call when done using logging for Chrome installer. void EndInstallerLogging(); // Returns the full path of the log file. -FilePath GetLogFilePath(const installer_util::MasterPreferences& prefs); +FilePath GetLogFilePath(const installer::MasterPreferences& prefs); } // namespace installer diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index a5f763c..8ae4913 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -75,7 +75,7 @@ DictionaryValue* ParseDistributionPreferences( } // namespace -namespace installer_util { +namespace installer { MasterPreferences::MasterPreferences() : distribution_(NULL), preferences_read_from_file_(false), @@ -117,9 +117,9 @@ MasterPreferences::~MasterPreferences() { void MasterPreferences::InitializeFromCommandLine(const CommandLine& cmd_line) { #if defined(OS_WIN) - if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) { + if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { FilePath prefs_path(cmd_line.GetSwitchValuePath( - installer_util::switches::kInstallerData)); + installer::switches::kInstallerData)); this->MasterPreferences::MasterPreferences(prefs_path); } else { master_dictionary_.reset(new DictionaryValue()); @@ -134,34 +134,34 @@ void MasterPreferences::InitializeFromCommandLine(const CommandLine& cmd_line) { const char* cmd_line_switch; const char* distribution_switch; } translate_switches[] = { - { installer_util::switches::kCeee, - installer_util::master_preferences::kCeee }, - { installer_util::switches::kChrome, - installer_util::master_preferences::kChrome }, - { installer_util::switches::kChromeFrame, - installer_util::master_preferences::kChromeFrame }, - { installer_util::switches::kCreateAllShortcuts, - installer_util::master_preferences::kCreateAllShortcuts }, - { installer_util::switches::kDisableLogging, - installer_util::master_preferences::kDisableLogging }, - { installer_util::switches::kDoNotCreateShortcuts, - installer_util::master_preferences::kDoNotCreateShortcuts }, - { installer_util::switches::kMsi, - installer_util::master_preferences::kMsi }, - { installer_util::switches::kMultiInstall, - installer_util::master_preferences::kMultiInstall }, - { installer_util::switches::kDoNotRegisterForUpdateLaunch, - installer_util::master_preferences::kDoNotRegisterForUpdateLaunch }, - { installer_util::switches::kDoNotLaunchChrome, - installer_util::master_preferences::kDoNotLaunchChrome }, - { installer_util::switches::kMakeChromeDefault, - installer_util::master_preferences::kMakeChromeDefault }, - { installer_util::switches::kSystemLevel, - installer_util::master_preferences::kSystemLevel }, - { installer_util::switches::kVerboseLogging, - installer_util::master_preferences::kVerboseLogging }, - { installer_util::switches::kAltDesktopShortcut, - installer_util::master_preferences::kAltShortcutText }, + { installer::switches::kCeee, + installer::master_preferences::kCeee }, + { installer::switches::kChrome, + installer::master_preferences::kChrome }, + { installer::switches::kChromeFrame, + installer::master_preferences::kChromeFrame }, + { installer::switches::kCreateAllShortcuts, + installer::master_preferences::kCreateAllShortcuts }, + { installer::switches::kDisableLogging, + installer::master_preferences::kDisableLogging }, + { installer::switches::kDoNotCreateShortcuts, + installer::master_preferences::kDoNotCreateShortcuts }, + { installer::switches::kMsi, + installer::master_preferences::kMsi }, + { installer::switches::kMultiInstall, + installer::master_preferences::kMultiInstall }, + { installer::switches::kDoNotRegisterForUpdateLaunch, + installer::master_preferences::kDoNotRegisterForUpdateLaunch }, + { installer::switches::kDoNotLaunchChrome, + installer::master_preferences::kDoNotLaunchChrome }, + { installer::switches::kMakeChromeDefault, + installer::master_preferences::kMakeChromeDefault }, + { installer::switches::kSystemLevel, + installer::master_preferences::kSystemLevel }, + { installer::switches::kVerboseLogging, + installer::master_preferences::kVerboseLogging }, + { installer::switches::kAltDesktopShortcut, + installer::master_preferences::kAltShortcutText }, }; std::string name(kDistroDict); @@ -175,10 +175,10 @@ void MasterPreferences::InitializeFromCommandLine(const CommandLine& cmd_line) { // See if the log file path was specified on the command line. std::wstring str_value(cmd_line.GetSwitchValueNative( - installer_util::switches::kLogFile)); + installer::switches::kLogFile)); if (!str_value.empty()) { name.resize(arraysize(kDistroDict) - 1); - name.append(".").append(installer_util::master_preferences::kLogFile); + name.append(".").append(installer::master_preferences::kLogFile); master_dictionary_->SetString(name, str_value); } @@ -196,9 +196,9 @@ void MasterPreferences::InitializeProductFlags() { ceee_ = false; chrome_ = true; - GetBool(installer_util::master_preferences::kMultiInstall, &multi_install_); - GetBool(installer_util::master_preferences::kChromeFrame, &chrome_frame_); - GetBool(installer_util::master_preferences::kCeee, &ceee_); + GetBool(installer::master_preferences::kMultiInstall, &multi_install_); + GetBool(installer::master_preferences::kChromeFrame, &chrome_frame_); + GetBool(installer::master_preferences::kCeee, &ceee_); // When multi-install is specified, the checks are pretty simple (in theory): // In order to be installed/uninstalled, each product must have its switch @@ -216,7 +216,7 @@ void MasterPreferences::InitializeProductFlags() { chrome_frame_ = true; if (multi_install_) { - if (!GetBool(installer_util::master_preferences::kChrome, &chrome_)) + if (!GetBool(installer::master_preferences::kChrome, &chrome_)) chrome_ = false; } else { // If chrome-frame is on the command line however, we only install CF. diff --git a/chrome/installer/util/master_preferences.h b/chrome/installer/util/master_preferences.h index f0d93c8..1dbf472 100644 --- a/chrome/installer/util/master_preferences.h +++ b/chrome/installer/util/master_preferences.h @@ -19,7 +19,7 @@ class DictionaryValue; class FilePath; -namespace installer_util { +namespace installer { // This is the default name for the master preferences file used to pre-set // values in the user profile at first run. @@ -196,6 +196,6 @@ class MasterPreferences { DISALLOW_COPY_AND_ASSIGN(MasterPreferences); }; -} // namespace installer_util +} // namespace installer #endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_H_ diff --git a/chrome/installer/util/master_preferences_constants.cc b/chrome/installer/util/master_preferences_constants.cc index d3e013c..0b71d9e 100644 --- a/chrome/installer/util/master_preferences_constants.cc +++ b/chrome/installer/util/master_preferences_constants.cc @@ -4,7 +4,7 @@ #include "chrome/installer/util/master_preferences_constants.h" -namespace installer_util { +namespace installer { namespace master_preferences { const char kAltFirstRunBubble[] = "oem_bubble"; const char kAltShortcutText[] = "alternate_shortcut_text"; @@ -41,4 +41,4 @@ namespace master_preferences { const char kVerboseLogging[] = "verbose_logging"; const char kExtensionsBlock[] = "extensions.settings"; } // namespace master_preferences -} // namespace installer_util +} // namespace installer diff --git a/chrome/installer/util/master_preferences_constants.h b/chrome/installer/util/master_preferences_constants.h index fbf6da4..1220a38 100644 --- a/chrome/installer/util/master_preferences_constants.h +++ b/chrome/installer/util/master_preferences_constants.h @@ -9,7 +9,7 @@ #define CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_CONSTANTS_H_ #pragma once -namespace installer_util { +namespace installer { 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 @@ -82,6 +82,6 @@ extern const char kVerboseLogging[]; // Name of the block that contains the extensions on the master preferences. extern const char kExtensionsBlock[]; } // namespace master_preferences -} // namespace installer_util +} // namespace installer #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 index 3f8f549..0112bee 100644 --- a/chrome/installer/util/master_preferences_dummy.cc +++ b/chrome/installer/util/master_preferences_dummy.cc @@ -16,7 +16,7 @@ #include "base/values.h" #include "googleurl/src/gurl.h" -namespace installer_util { +namespace installer { MasterPreferences::MasterPreferences(const CommandLine& cmd_line) : distribution_(NULL), preferences_read_from_file_(false) { diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc index 8490025..3d8f192 100644 --- a/chrome/installer/util/master_preferences_unittest.cc +++ b/chrome/installer/util/master_preferences_unittest.cc @@ -71,25 +71,25 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) { "} \n"; EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, sizeof(text))); - installer_util::MasterPreferences prefs(prefs_file()); + installer::MasterPreferences prefs(prefs_file()); const char* expected_true[] = { - installer_util::master_preferences::kDistroSkipFirstRunPref, - installer_util::master_preferences::kDistroShowWelcomePage, - installer_util::master_preferences::kDistroImportSearchPref, - installer_util::master_preferences::kDistroImportHistoryPref, - installer_util::master_preferences::kDistroImportBookmarksPref, - installer_util::master_preferences::kDistroImportHomePagePref, - installer_util::master_preferences::kCreateAllShortcuts, - installer_util::master_preferences::kDoNotLaunchChrome, - installer_util::master_preferences::kMakeChromeDefault, - installer_util::master_preferences::kMakeChromeDefaultForUser, - installer_util::master_preferences::kSystemLevel, - installer_util::master_preferences::kVerboseLogging, - installer_util::master_preferences::kRequireEula, - installer_util::master_preferences::kAltShortcutText, - installer_util::master_preferences::kAltFirstRunBubble, - installer_util::master_preferences::kSearchEngineExperimentPref, + installer::master_preferences::kDistroSkipFirstRunPref, + installer::master_preferences::kDistroShowWelcomePage, + installer::master_preferences::kDistroImportSearchPref, + installer::master_preferences::kDistroImportHistoryPref, + installer::master_preferences::kDistroImportBookmarksPref, + installer::master_preferences::kDistroImportHomePagePref, + installer::master_preferences::kCreateAllShortcuts, + installer::master_preferences::kDoNotLaunchChrome, + installer::master_preferences::kMakeChromeDefault, + installer::master_preferences::kMakeChromeDefaultForUser, + installer::master_preferences::kSystemLevel, + installer::master_preferences::kVerboseLogging, + installer::master_preferences::kRequireEula, + installer::master_preferences::kAltShortcutText, + installer::master_preferences::kAltFirstRunBubble, + installer::master_preferences::kSearchEngineExperimentPref, }; for (int i = 0; i < arraysize(expected_true); ++i) { @@ -100,17 +100,17 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) { std::string str_value; EXPECT_TRUE(prefs.GetString( - installer_util::master_preferences::kDistroImportBookmarksFromFilePref, + installer::master_preferences::kDistroImportBookmarksFromFilePref, &str_value)); EXPECT_STREQ("c:\\foo", str_value.c_str()); int icon_index = 0; EXPECT_TRUE(prefs.GetInt( - installer_util::master_preferences::kChromeShortcutIconIndex, + installer::master_preferences::kChromeShortcutIconIndex, &icon_index)); EXPECT_EQ(icon_index, 1); int ping_delay = 90; - EXPECT_TRUE(prefs.GetInt(installer_util::master_preferences::kDistroPingDelay, + EXPECT_TRUE(prefs.GetInt(installer::master_preferences::kDistroPingDelay, &ping_delay)); EXPECT_EQ(ping_delay, 40); } @@ -130,14 +130,14 @@ TEST_F(MasterPreferencesTest, ParseMissingDistroParams) { "} \n"; EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, sizeof(text))); - installer_util::MasterPreferences prefs(prefs_file()); + installer::MasterPreferences prefs(prefs_file()); ExpectedBooleans expected_bool[] = { - { installer_util::master_preferences::kDistroSkipFirstRunPref, true }, - { installer_util::master_preferences::kDistroImportSearchPref, true }, - { installer_util::master_preferences::kDistroImportBookmarksPref, false }, - { installer_util::master_preferences::kCreateAllShortcuts, true }, - { installer_util::master_preferences::kDoNotLaunchChrome, true }, + { installer::master_preferences::kDistroSkipFirstRunPref, true }, + { installer::master_preferences::kDistroImportSearchPref, true }, + { installer::master_preferences::kDistroImportBookmarksPref, false }, + { installer::master_preferences::kCreateAllShortcuts, true }, + { installer::master_preferences::kDoNotLaunchChrome, true }, }; bool value = false; @@ -147,12 +147,12 @@ TEST_F(MasterPreferencesTest, ParseMissingDistroParams) { } const char* missing_bools[] = { - installer_util::master_preferences::kDistroShowWelcomePage, - installer_util::master_preferences::kDistroImportHistoryPref, - installer_util::master_preferences::kDistroImportHomePagePref, - installer_util::master_preferences::kDoNotRegisterForUpdateLaunch, - installer_util::master_preferences::kMakeChromeDefault, - installer_util::master_preferences::kMakeChromeDefaultForUser, + installer::master_preferences::kDistroShowWelcomePage, + installer::master_preferences::kDistroImportHistoryPref, + installer::master_preferences::kDistroImportHomePagePref, + installer::master_preferences::kDoNotRegisterForUpdateLaunch, + installer::master_preferences::kMakeChromeDefault, + installer::master_preferences::kMakeChromeDefaultForUser, }; for (int i = 0; i < arraysize(missing_bools); ++i) { @@ -161,18 +161,18 @@ TEST_F(MasterPreferencesTest, ParseMissingDistroParams) { std::string str_value; EXPECT_FALSE(prefs.GetString( - installer_util::master_preferences::kDistroImportBookmarksFromFilePref, + installer::master_preferences::kDistroImportBookmarksFromFilePref, &str_value)); int icon_index = 0; EXPECT_FALSE(prefs.GetInt( - installer_util::master_preferences::kChromeShortcutIconIndex, + installer::master_preferences::kChromeShortcutIconIndex, &icon_index)); EXPECT_EQ(icon_index, 0); int ping_delay = 90; EXPECT_FALSE(prefs.GetInt( - installer_util::master_preferences::kDistroPingDelay, &ping_delay)); + installer::master_preferences::kDistroPingDelay, &ping_delay)); EXPECT_EQ(ping_delay, 90); } @@ -190,7 +190,7 @@ TEST_F(MasterPreferencesTest, FirstRunTabs) { "} \n"; EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, sizeof(text))); - installer_util::MasterPreferences prefs(prefs_file()); + installer::MasterPreferences prefs(prefs_file()); typedef std::vector TabsVector; TabsVector tabs = prefs.GetFirstRunTabs(); ASSERT_EQ(3, tabs.size()); @@ -209,7 +209,7 @@ TEST(MasterPrefsExtension, ValidateExtensionJSON) { prefs_path = prefs_path.AppendASCII("extensions") .AppendASCII("good").AppendASCII("Preferences"); - installer_util::MasterPreferences prefs(prefs_path); + installer::MasterPreferences prefs(prefs_path); DictionaryValue* extensions = NULL; EXPECT_TRUE(prefs.GetExtensionsBlock(&extensions)); int location = 0; @@ -256,16 +256,16 @@ TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) { cmd_str.append(L" --do-not-launch-chrome"); cmd_str.append(L" --alt-desktop-shortcut"); CommandLine cmd_line = CommandLine::FromString(cmd_str); - installer_util::MasterPreferences prefs(cmd_line); + installer::MasterPreferences prefs(cmd_line); // Check prefs that do not have any equivalent command line option. ExpectedBooleans expected_bool[] = { - { installer_util::master_preferences::kDistroSkipFirstRunPref, true }, - { installer_util::master_preferences::kCreateAllShortcuts, true }, - { installer_util::master_preferences::kDoNotLaunchChrome, true }, - { installer_util::master_preferences::kAltShortcutText, true }, - { installer_util::master_preferences::kSystemLevel, true }, - { installer_util::master_preferences::kVerboseLogging, false }, + { installer::master_preferences::kDistroSkipFirstRunPref, true }, + { installer::master_preferences::kCreateAllShortcuts, true }, + { installer::master_preferences::kDoNotLaunchChrome, true }, + { installer::master_preferences::kAltShortcutText, true }, + { installer::master_preferences::kSystemLevel, true }, + { installer::master_preferences::kVerboseLogging, false }, }; // Now check that prefs got merged correctly. @@ -283,11 +283,11 @@ TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) { cmd_str = L"setup.exe --create-all-shortcuts --do-not-launch-chrome" L" --alt-desktop-shortcut"; cmd_line.ParseFromString(cmd_str); - installer_util::MasterPreferences prefs2(cmd_line); + installer::MasterPreferences prefs2(cmd_line); ExpectedBooleans expected_bool2[] = { - { installer_util::master_preferences::kCreateAllShortcuts, true }, - { installer_util::master_preferences::kDoNotLaunchChrome, true }, - { installer_util::master_preferences::kAltShortcutText, true }, + { installer::master_preferences::kCreateAllShortcuts, true }, + { installer::master_preferences::kDoNotLaunchChrome, true }, + { installer::master_preferences::kAltShortcutText, true }, }; for (int i = 0; i < arraysize(expected_bool2); ++i) { @@ -297,24 +297,24 @@ TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) { } EXPECT_FALSE(prefs2.GetBool( - installer_util::master_preferences::kSystemLevel, &value)); + installer::master_preferences::kSystemLevel, &value)); EXPECT_FALSE(prefs2.GetBool( - installer_util::master_preferences::kVerboseLogging, &value)); + installer::master_preferences::kVerboseLogging, &value)); } TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) { std::wstringstream chrome_cmd, cf_cmd, ceee_cmd; chrome_cmd << "setup.exe"; - cf_cmd << "setup.exe --" << installer_util::switches::kChromeFrame; - ceee_cmd << "setup.exe --" << installer_util::switches::kCeee; + cf_cmd << "setup.exe --" << installer::switches::kChromeFrame; + ceee_cmd << "setup.exe --" << installer::switches::kCeee; CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); CommandLine ceee_install(CommandLine::FromString(ceee_cmd.str())); - installer_util::MasterPreferences pref_chrome(chrome_install); - installer_util::MasterPreferences pref_cf(cf_install); - installer_util::MasterPreferences pref_ceee(ceee_install); + installer::MasterPreferences pref_chrome(chrome_install); + installer::MasterPreferences pref_cf(cf_install); + installer::MasterPreferences pref_ceee(ceee_install); EXPECT_FALSE(pref_chrome.is_multi_install()); EXPECT_TRUE(pref_chrome.install_chrome()); @@ -333,10 +333,10 @@ TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) { } TEST_F(MasterPreferencesTest, TestMultiInstallConfig) { - using installer_util::switches::kMultiInstall; - using installer_util::switches::kChrome; - using installer_util::switches::kChromeFrame; - using installer_util::switches::kCeee; + using installer::switches::kMultiInstall; + using installer::switches::kChrome; + using installer::switches::kChromeFrame; + using installer::switches::kCeee; std::wstringstream chrome_cmd, cf_cmd, ceee_cmd, chrome_cf_cmd, chrome_ceee_cf_cmd; @@ -355,11 +355,11 @@ TEST_F(MasterPreferencesTest, TestMultiInstallConfig) { CommandLine chrome_cf_ceee_install( CommandLine::FromString(chrome_ceee_cf_cmd.str())); - installer_util::MasterPreferences pref_chrome(chrome_install); - installer_util::MasterPreferences pref_cf(cf_install); - installer_util::MasterPreferences pref_ceee(ceee_install); - installer_util::MasterPreferences pref_chrome_cf(chrome_cf_install); - installer_util::MasterPreferences pref_all(chrome_cf_ceee_install); + installer::MasterPreferences pref_chrome(chrome_install); + installer::MasterPreferences pref_cf(cf_install); + installer::MasterPreferences pref_ceee(ceee_install); + installer::MasterPreferences pref_chrome_cf(chrome_cf_install); + installer::MasterPreferences pref_all(chrome_cf_ceee_install); EXPECT_TRUE(pref_chrome.is_multi_install()); EXPECT_TRUE(pref_chrome.install_chrome()); diff --git a/chrome/installer/util/package.cc b/chrome/installer/util/package.cc index d662548..cc94cd6 100644 --- a/chrome/installer/util/package.cc +++ b/chrome/installer/util/package.cc @@ -58,14 +58,14 @@ bool Package::system_level() const { FilePath Package::GetInstallerDirectory( const Version& version) const { return path_.Append(version.GetString()) - .Append(installer_util::kInstallerDir); + .Append(installer::kInstallerDir); } Version* Package::GetCurrentVersion() const { scoped_ptr current_version; // Be aware that there might be a pending "new_chrome.exe" already in the // installation path. - FilePath new_chrome_exe(path_.Append(installer_util::kChromeNewExe)); + FilePath new_chrome_exe(path_.Append(installer::kChromeNewExe)); bool new_chrome_exists = file_util::PathExists(new_chrome_exe); for (size_t i = 0; i < products_.size(); ++i) { diff --git a/chrome/installer/util/package_unittest.cc b/chrome/installer/util/package_unittest.cc index 8512a71..6a83762 100644 --- a/chrome/installer/util/package_unittest.cc +++ b/chrome/installer/util/package_unittest.cc @@ -57,7 +57,7 @@ TEST_F(PackageTest, Basic) { // Create a fake chrome.dll key file in the old version directory. This // should prevent the old version directory from getting deleted. - FilePath old_chrome_dll(old_version_dir.Append(installer_util::kChromeDll)); + FilePath old_chrome_dll(old_version_dir.Append(installer::kChromeDll)); EXPECT_FALSE(file_util::PathExists(old_chrome_dll)); // Hold on to the file exclusively to prevent the directory from @@ -87,8 +87,8 @@ TEST_F(PackageTest, Basic) { TEST_F(PackageTest, WithProduct) { TempRegKeyOverride::DeleteAllTempKeys(); - const installer_util::MasterPreferences& prefs = - installer_util::MasterPreferences::ForCurrentProcess(); + const installer::MasterPreferences& prefs = + installer::MasterPreferences::ForCurrentProcess(); // TODO(tommi): We should mock this and use our mocked distribution. const bool system_level = true; diff --git a/chrome/installer/util/product.cc b/chrome/installer/util/product.cc index 7560cd0..6565111 100644 --- a/chrome/installer/util/product.cc +++ b/chrome/installer/util/product.cc @@ -19,7 +19,7 @@ #include "chrome/installer/util/work_item_list.h" using base::win::RegKey; -using installer_util::MasterPreferences; +using installer::MasterPreferences; namespace { class ProductIsOfType { @@ -45,7 +45,7 @@ const Product* FindProduct(const Products& products, } void WriteInstallerResult(const Products& products, - installer_util::InstallStatus status, + installer::InstallStatus status, int string_resource_id, const std::wstring* const launch_cmd) { Products::const_iterator end = products.end(); @@ -76,7 +76,7 @@ bool Product::LaunchChrome() const { const FilePath& install_package = package_->path(); bool success = !install_package.empty(); if (success) { - CommandLine cmd(install_package.Append(installer_util::kChromeExe)); + CommandLine cmd(install_package.Append(installer::kChromeExe)); success = base::LaunchApp(cmd, false, false, NULL); } return success; @@ -88,7 +88,7 @@ bool Product::LaunchChromeAndWait(const CommandLine& options, if (install_package.empty()) return false; - CommandLine cmd(install_package.Append(installer_util::kChromeExe)); + CommandLine cmd(install_package.Append(installer::kChromeExe)); cmd.AppendArguments(options, false); bool success = false; @@ -129,10 +129,10 @@ bool Product::IsMsi() const { msi_ = NOT_MSI; // Covers failure cases below. const MasterPreferences& prefs = - installer_util::MasterPreferences::ForCurrentProcess(); + installer::MasterPreferences::ForCurrentProcess(); bool is_msi = false; - prefs.GetBool(installer_util::master_preferences::kMsi, &is_msi); + prefs.GetBool(installer::master_preferences::kMsi, &is_msi); if (!is_msi) { // We didn't find it in the preferences, try looking in the registry. @@ -172,7 +172,7 @@ bool Product::SetMsiMarker(bool set) const { } void Product::WriteInstallerResult( - installer_util::InstallStatus status, int string_resource_id, + installer::InstallStatus status, int string_resource_id, const std::wstring* const launch_cmd) const { HKEY root = system_level_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; std::wstring key(distribution_->GetStateKey()); @@ -181,19 +181,19 @@ void Product::WriteInstallerResult( scoped_ptr install_list(WorkItem::CreateWorkItemList()); install_list->AddCreateRegKeyWorkItem(root, key); install_list->AddSetRegValueWorkItem(root, key, - installer_util::kInstallerResult, + installer::kInstallerResult, installer_result, true); install_list->AddSetRegValueWorkItem(root, key, - installer_util::kInstallerError, + installer::kInstallerError, status, true); if (string_resource_id != 0) { - std::wstring msg = installer_util::GetLocalizedString(string_resource_id); + std::wstring msg = installer::GetLocalizedString(string_resource_id); install_list->AddSetRegValueWorkItem(root, key, - installer_util::kInstallerResultUIString, msg, true); + installer::kInstallerResultUIString, msg, true); } if (launch_cmd != NULL && !launch_cmd->empty()) { install_list->AddSetRegValueWorkItem(root, key, - installer_util::kInstallerSuccessLaunchCmdLine, *launch_cmd, true); + installer::kInstallerSuccessLaunchCmdLine, *launch_cmd, true); } if (!install_list->Do()) LOG(ERROR) << "Failed to record installer error information in registry."; @@ -252,7 +252,7 @@ bool ProductPackageMapping::AddDistribution(BrowserDistribution* distribution) { bool ProductPackageMapping::AddDistribution( BrowserDistribution::Type type, - const installer_util::MasterPreferences& prefs) { + const installer::MasterPreferences& prefs) { BrowserDistribution* distribution = BrowserDistribution::GetSpecificDistribution(type, prefs); if (!distribution) { diff --git a/chrome/installer/util/product.h b/chrome/installer/util/product.h index 49a375e..45ee2c2 100644 --- a/chrome/installer/util/product.h +++ b/chrome/installer/util/product.h @@ -14,7 +14,7 @@ class CommandLine; -namespace installer_util { +namespace installer { class MasterPreferences; } @@ -32,7 +32,7 @@ const Product* FindProduct(const Products& products, // Calls WriteInstallerResult for each Product object. void WriteInstallerResult(const Products& products, - installer_util::InstallStatus status, + installer::InstallStatus status, int string_resource_id, const std::wstring* const launch_cmd); @@ -96,7 +96,7 @@ class Product : public base::RefCounted { // Sets installer error information in registry so that Google Update can read // it and display to the user. - void WriteInstallerResult(installer_util::InstallStatus status, + void WriteInstallerResult(installer::InstallStatus status, int string_resource_id, const std::wstring* const launch_cmd) const; @@ -139,7 +139,7 @@ class ProductPackageMapping { const Products& products() const; bool AddDistribution(BrowserDistribution::Type type, - const installer_util::MasterPreferences& prefs); + const installer::MasterPreferences& prefs); bool AddDistribution(BrowserDistribution* distribution); protected: diff --git a/chrome/installer/util/product_unittest.cc b/chrome/installer/util/product_unittest.cc index 20988e4..4b73b7a 100644 --- a/chrome/installer/util/product_unittest.cc +++ b/chrome/installer/util/product_unittest.cc @@ -17,7 +17,7 @@ using installer::Package; using installer::Product; using installer::ProductPackageMapping; using installer::Version; -using installer_util::MasterPreferences; +using installer::MasterPreferences; void TestWithTempDir::SetUp() { // Name a subdirectory of the user temp directory. @@ -78,8 +78,8 @@ class ProductTest : public TestWithTempDirAndDeleteTempOverrideKeys { TEST_F(ProductTest, ProductInstallBasic) { // TODO(tommi): We should mock this and use our mocked distribution. const bool system_level = true; - const installer_util::MasterPreferences& prefs = - installer_util::MasterPreferences::ForCurrentProcess(); + const installer::MasterPreferences& prefs = + installer::MasterPreferences::ForCurrentProcess(); BrowserDistribution* distribution = BrowserDistribution::GetSpecificDistribution( BrowserDistribution::CHROME_BROWSER, prefs); @@ -91,7 +91,7 @@ TEST_F(ProductTest, ProductInstallBasic) { FilePath user_data(product->GetUserDataPath()); EXPECT_FALSE(user_data.empty()); EXPECT_NE(std::wstring::npos, - user_data.value().find(installer_util::kInstallUserDataDir)); + user_data.value().find(installer::kInstallUserDataDir)); FilePath program_files; PathService::Get(base::DIR_PROGRAM_FILES, &program_files); @@ -121,10 +121,10 @@ TEST_F(ProductTest, ProductInstallBasic) { // See if WriteInstallerResult writes anything. std::wstring launch_cmd(L"chrome.exe --this-is-a-test"); - product->WriteInstallerResult(installer_util::TEMP_DIR_FAILED, + product->WriteInstallerResult(installer::TEMP_DIR_FAILED, 0, &launch_cmd); std::wstring found_launch_cmd; - key.ReadValue(installer_util::kInstallerSuccessLaunchCmdLine, + key.ReadValue(installer::kInstallerSuccessLaunchCmdLine, &found_launch_cmd); EXPECT_EQ(launch_cmd, found_launch_cmd); @@ -161,11 +161,11 @@ TEST_F(ProductTest, LaunchChrome) { class FakeChromeFrameDistribution : public ChromeFrameDistribution { public: explicit FakeChromeFrameDistribution( - const installer_util::MasterPreferences& prefs) + const installer::MasterPreferences& prefs) : ChromeFrameDistribution(prefs) {} virtual std::wstring GetInstallSubDir() { const MasterPreferences& prefs = - installer_util::MasterPreferences::ForCurrentProcess(); + installer::MasterPreferences::ForCurrentProcess(); return BrowserDistribution::GetSpecificDistribution( BrowserDistribution::CHROME_BROWSER, prefs)->GetInstallSubDir(); } @@ -180,7 +180,7 @@ TEST_F(ProductTest, ProductInstallsBasic) { // TODO(robertshield): Include test that use mock master preferences. const MasterPreferences& prefs = - installer_util::MasterPreferences::ForCurrentProcess(); + installer::MasterPreferences::ForCurrentProcess(); installs.AddDistribution(BrowserDistribution::CHROME_BROWSER, prefs); FakeChromeFrameDistribution fake_chrome_frame(prefs); diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 734c90d9..1c90453 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -306,29 +306,29 @@ bool ElevateAndRegisterChrome(BrowserDistribution* dist, const std::wstring& suffix) { FilePath exe_path = FilePath::FromWStringHack(chrome_exe).DirName() - .Append(installer_util::kSetupExe); + .Append(installer::kSetupExe); if (!file_util::PathExists(exe_path)) { HKEY reg_root = InstallUtil::IsPerUserInstall(chrome_exe.c_str()) ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; RegKey key(reg_root, dist->GetUninstallRegPath().c_str(), KEY_READ); std::wstring uninstall_string; - key.ReadValue(installer_util::kUninstallStringField, &uninstall_string); + key.ReadValue(installer::kUninstallStringField, &uninstall_string); CommandLine command_line = CommandLine::FromString(uninstall_string); exe_path = command_line.GetProgram(); } if (file_util::PathExists(exe_path)) { CommandLine cmd(exe_path); - cmd.AppendSwitchNative(installer_util::switches::kRegisterChromeBrowser, + cmd.AppendSwitchNative(installer::switches::kRegisterChromeBrowser, chrome_exe); if (!suffix.empty()) { cmd.AppendSwitchNative( - installer_util::switches::kRegisterChromeBrowserSuffix, suffix); + installer::switches::kRegisterChromeBrowserSuffix, suffix); } CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); if (browser_command_line.HasSwitch(switches::kChromeFrame)) { - cmd.AppendSwitch(installer_util::switches::kChromeFrame); + cmd.AppendSwitch(installer::switches::kChromeFrame); } DWORD ret_val = 0; @@ -788,10 +788,10 @@ bool ShellUtil::UpdateChromeShortcut(BrowserDistribution* dist, std::wstring chrome_path = file_util::GetDirectoryFromPath(chrome_exe); FilePath prefs_path(chrome_path); - prefs_path = prefs_path.AppendASCII(installer_util::kDefaultMasterPrefs); - installer_util::MasterPreferences prefs(prefs_path); + prefs_path = prefs_path.AppendASCII(installer::kDefaultMasterPrefs); + installer::MasterPreferences prefs(prefs_path); int icon_index = dist->GetIconIndex(); - prefs.GetInt(installer_util::master_preferences::kChromeShortcutIconIndex, + prefs.GetInt(installer::master_preferences::kChromeShortcutIconIndex, &icon_index); if (create_new) { return file_util::CreateShortcutLink( diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index a5d917e..b96b566 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc @@ -130,7 +130,7 @@ TEST_F(ShellUtilTest, UpdateChromeShortcutTest) { // Now specify an icon index in master prefs and make sure it works. FilePath prefs_path = test_dir_.AppendASCII( - installer_util::kDefaultMasterPrefs); + installer::kDefaultMasterPrefs); std::ofstream file; file.open(prefs_path.value().c_str()); ASSERT_TRUE(file.is_open()); diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index 961b878..f3a062f 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc @@ -4,7 +4,7 @@ #include "chrome/installer/util/util_constants.h" -namespace installer_util { +namespace installer { namespace switches { @@ -161,4 +161,4 @@ const wchar_t kInstallerResultUIString[] = L"InstallerResultUIString"; const wchar_t kInstallerSuccessLaunchCmdLine[] = L"InstallerSuccessLaunchCmdLine"; -} // namespace installer_util +} // namespace installer diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index c1ee5a8..933cab5 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -9,7 +9,7 @@ #define CHROME_INSTALLER_UTIL_UTIL_CONSTANTS_H_ #pragma once -namespace installer_util { +namespace installer { // Return status of installer enum InstallStatus { @@ -118,6 +118,6 @@ extern const wchar_t kInstallerError[]; extern const wchar_t kInstallerResultUIString[]; extern const wchar_t kInstallerSuccessLaunchCmdLine[]; -} // namespace installer_util +} // namespace installer #endif // CHROME_INSTALLER_UTIL_UTIL_CONSTANTS_H_ -- cgit v1.1