diff options
58 files changed, 550 insertions, 550 deletions
diff --git a/ceee/common/install_utils.cc b/ceee/common/install_utils.cc index e737d5b..e342023 100644 --- a/ceee/common/install_utils.cc +++ b/ceee/common/install_utils.cc @@ -13,7 +13,7 @@ #include "base/path_service.h" #include "chrome/installer/util/util_constants.h" -namespace installer_util { +namespace installer { namespace switches { // TODO(joi@chromium.org) Move to chrome/installer/util_constants.h // when we refactor this logic to be in the installer rather than @@ -43,10 +43,10 @@ bool ShouldRegisterImpl(bool check_firefox) { // also be provided. CommandLine current_command_line(CommandLine::NO_PROGRAM); current_command_line.ParseFromString(::GetCommandLine()); - if (current_command_line.HasSwitch(installer_util::switches::kEnableCeee) && - current_command_line.HasSwitch(installer_util::switches::kChromeFrame) && + if (current_command_line.HasSwitch(installer::switches::kEnableCeee) && + current_command_line.HasSwitch(installer::switches::kChromeFrame) && (!check_firefox || current_command_line.HasSwitch( - installer_util::switches::kEnableFfCeee))) { + installer::switches::kEnableFfCeee))) { return true; } else { return false; diff --git a/ceee/installer_dll/installer_helper.cc b/ceee/installer_dll/installer_helper.cc index a435e17..003bb9f 100644 --- a/ceee/installer_dll/installer_helper.cc +++ b/ceee/installer_dll/installer_helper.cc @@ -263,7 +263,7 @@ HRESULT SetCeeeChannelModifier(bool new_value) { } // We create the "ap" value if it doesn't exist. - installer_util::ChannelInfo channel_info; + installer::ChannelInfo channel_info; channel_info.Initialize(key); if (channel_info.SetCeee(new_value) && !channel_info.Write(&key)) { diff --git a/chrome/app/client_util.cc b/chrome/app/client_util.cc index d49e78d..0c1a8ac 100644 --- a/chrome/app/client_util.cc +++ b/chrome/app/client_util.cc @@ -58,7 +58,7 @@ bool GetVersion(const wchar_t* exe_path, const wchar_t* key_path, // TODO(cpu) : This is solving the same problem as the environment variable // so one of them will eventually be deprecated. std::wstring new_chrome_exe(exe_path); - new_chrome_exe.append(installer_util::kChromeNewExe); + new_chrome_exe.append(installer::kChromeNewExe); if (::PathFileExistsW(new_chrome_exe.c_str()) && ReadRegistryStr(key, google_update::kRegOldVersionField, version)) { ::RegCloseKey(key); @@ -103,14 +103,14 @@ HMODULE LoadChromeWithDirectory(std::wstring* dir) { (cmd_line.GetSwitchValueASCII(switches::kProcessType) == switches::kNaClLoaderProcess)) { // Load the 64-bit DLL when running in a 64-bit process. - dir->append(installer_util::kChromeNaCl64Dll); + dir->append(installer::kChromeNaCl64Dll); } else { // Only NaCl broker and loader can be launched as Win64 processes. NOTREACHED(); return NULL; } #else - dir->append(installer_util::kChromeDll); + dir->append(installer::kChromeDll); #endif #ifdef NDEBUG diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc index 66f6c6e..a395d48 100644 --- a/chrome/browser/browser_main_win.cc +++ b/chrome/browser/browser_main_win.cc @@ -199,9 +199,9 @@ bool CheckMachineLevelInstall() { FilePath uninstall_path(InstallUtil::GetChromeUninstallCmd(false, dist)); CommandLine uninstall_cmd(uninstall_path); if (!uninstall_cmd.GetProgram().value().empty()) { - uninstall_cmd.AppendSwitch(installer_util::switches::kForceUninstall); + uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); uninstall_cmd.AppendSwitch( - installer_util::switches::kDoNotRemoveSharedItems); + installer::switches::kDoNotRemoveSharedItems); base::LaunchApp(uninstall_cmd, false, false, NULL); } return true; diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index 874cebb..4235a8a 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -94,9 +94,9 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, FilePath master_prefs; if (!PathService::Get(base::DIR_EXE, &master_prefs)) return true; - master_prefs = master_prefs.AppendASCII(installer_util::kDefaultMasterPrefs); + master_prefs = master_prefs.AppendASCII(installer::kDefaultMasterPrefs); - installer_util::MasterPreferences prefs(master_prefs); + installer::MasterPreferences prefs(master_prefs); if (!prefs.read_from_file()) return true; @@ -107,14 +107,14 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, #if defined(OS_WIN) // RLZ is currently a Windows-only phenomenon. When it comes to the Mac/ // Linux, enable it here. - if (!prefs.GetInt(installer_util::master_preferences::kDistroPingDelay, + if (!prefs.GetInt(installer::master_preferences::kDistroPingDelay, &out_prefs->ping_delay)) { // 90 seconds is the default that we want to use in case master // preferences is missing, corrupt or ping_delay is missing. out_prefs->ping_delay = 90; } - if (prefs.GetBool(installer_util::master_preferences::kRequireEula, &value) && + if (prefs.GetBool(installer::master_preferences::kRequireEula, &value) && value) { // Show the post-installation EULA. This is done by setup.exe and the // result determines if we continue or not. We wait here until the user @@ -125,16 +125,16 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, FilePath inner_html; if (WriteEULAtoTempFile(&inner_html)) { int retcode = 0; - if (!LaunchSetupWithParam(installer_util::switches::kShowEula, + if (!LaunchSetupWithParam(installer::switches::kShowEula, inner_html.ToWStringHack(), &retcode) || - (retcode == installer_util::EULA_REJECTED)) { + (retcode == installer::EULA_REJECTED)) { LOG(WARNING) << "EULA rejected. Fast exit."; ::ExitProcess(1); } - if (retcode == installer_util::EULA_ACCEPTED) { + if (retcode == installer::EULA_ACCEPTED) { VLOG(1) << "EULA : no collection"; GoogleUpdateSettings::SetCollectStatsConsent(false); - } else if (retcode == installer_util::EULA_ACCEPTED_OPT_IN) { + } else if (retcode == installer::EULA_ACCEPTED_OPT_IN) { VLOG(1) << "EULA : collection consent"; GoogleUpdateSettings::SetCollectStatsConsent(true); } @@ -142,7 +142,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, } #endif - if (prefs.GetBool(installer_util::master_preferences::kAltFirstRunBubble, + if (prefs.GetBool(installer::master_preferences::kAltFirstRunBubble, &value) && value) { FirstRun::SetOEMFirstRunBubblePref(); } @@ -164,7 +164,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, } #endif - if (prefs.GetBool(installer_util::master_preferences::kDistroImportSearchPref, + if (prefs.GetBool(installer::master_preferences::kDistroImportSearchPref, &value)) { if (value) { out_prefs->do_import_items |= importer::SEARCH_ENGINES; @@ -175,7 +175,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, // Check to see if search engine logos should be randomized. if (prefs.GetBool( - installer_util::master_preferences:: + installer::master_preferences:: kSearchEngineExperimentRandomizePref, &value) && value) { out_prefs->randomize_search_engine_experiment = true; @@ -186,12 +186,12 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, // user is guaranteed to see the bubble iff he or she has completed the first // run process. if (prefs.GetBool( - installer_util::master_preferences::kDistroSuppressFirstRunBubble, + installer::master_preferences::kDistroSuppressFirstRunBubble, &value) && value) FirstRun::SetShowFirstRunBubblePref(false); if (prefs.GetBool( - installer_util::master_preferences::kDistroImportHistoryPref, + installer::master_preferences::kDistroImportHistoryPref, &value)) { if (value) { out_prefs->do_import_items |= importer::HISTORY; @@ -204,7 +204,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, out_prefs->homepage_defined = prefs.GetString(prefs::kHomePage, ¬_used); if (prefs.GetBool( - installer_util::master_preferences::kDistroImportHomePagePref, + installer::master_preferences::kDistroImportHomePagePref, &value)) { if (value) { out_prefs->do_import_items |= importer::HOME_PAGE; @@ -215,13 +215,13 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, // Bookmarks are never imported unless specifically turned on. if (prefs.GetBool( - installer_util::master_preferences::kDistroImportBookmarksPref, + installer::master_preferences::kDistroImportBookmarksPref, &value) && value) { out_prefs->do_import_items |= importer::FAVORITES; } if (prefs.GetBool( - installer_util::master_preferences::kMakeChromeDefaultForUser, + installer::master_preferences::kMakeChromeDefaultForUser, &value) && value) { out_prefs->make_chrome_default = true; } @@ -231,7 +231,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, // Note we are skipping all other master preferences if skip-first-run-ui // is *not* specified. (That is, we continue only if skipping first run ui.) if (!prefs.GetBool( - installer_util::master_preferences::kDistroSkipFirstRunPref, + installer::master_preferences::kDistroSkipFirstRunPref, &value) || !value) { return true; } @@ -248,14 +248,14 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, if (!FirstRun::CreateSentinel()) return false; - if (prefs.GetBool(installer_util::master_preferences::kDistroShowWelcomePage, + if (prefs.GetBool(installer::master_preferences::kDistroShowWelcomePage, &value) && value) { FirstRun::SetShowWelcomePagePref(); } std::string import_bookmarks_path; prefs.GetString( - installer_util::master_preferences::kDistroImportBookmarksFromFilePref, + installer::master_preferences::kDistroImportBookmarksFromFilePref, &import_bookmarks_path); #if defined(OS_WIN) @@ -302,7 +302,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, #endif if (prefs.GetBool( - installer_util::master_preferences::kMakeChromeDefaultForUser, + installer::master_preferences::kMakeChromeDefaultForUser, &value) && value) { ShellIntegration::SetAsDefaultBrowser(); } diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc index 293d3d2..995dcb2 100644 --- a/chrome/browser/first_run/first_run_win.cc +++ b/chrome/browser/first_run/first_run_win.cc @@ -65,7 +65,7 @@ namespace { bool GetNewerChromeFile(FilePath* path) { if (!PathService::Get(base::DIR_EXE, path)) return false; - *path = path->Append(installer_util::kChromeNewExe); + *path = path->Append(installer::kChromeNewExe); return true; } @@ -83,7 +83,7 @@ bool InvokeGoogleUpdateForRename() { DWORD exit_code; ::GetExitCodeProcess(handle, &exit_code); ::CloseHandle(handle); - if (exit_code == installer_util::RENAME_SUCCESSFUL) + if (exit_code == installer::RENAME_SUCCESSFUL) return true; } } @@ -95,8 +95,8 @@ bool LaunchSetupWithParam(const std::string& param, const std::wstring& value, FilePath exe_path; if (!PathService::Get(base::DIR_MODULE, &exe_path)) return false; - exe_path = exe_path.Append(installer_util::kInstallerDir); - exe_path = exe_path.Append(installer_util::kSetupExe); + exe_path = exe_path.Append(installer::kInstallerDir); + exe_path = exe_path.Append(installer::kSetupExe); base::ProcessHandle ph; CommandLine cl(exe_path); cl.AppendSwitchNative(param, value); @@ -180,8 +180,8 @@ bool FirstRun::LaunchSetupWithParam(const std::string& param, FilePath exe_path; if (!PathService::Get(base::DIR_MODULE, &exe_path)) return false; - exe_path = exe_path.Append(installer_util::kInstallerDir); - exe_path = exe_path.Append(installer_util::kSetupExe); + exe_path = exe_path.Append(installer::kInstallerDir); + exe_path = exe_path.Append(installer::kSetupExe); base::ProcessHandle ph; CommandLine cl(exe_path); cl.AppendSwitchNative(param, value); @@ -286,7 +286,7 @@ bool Upgrade::SwapNewChromeExeIfPresent() { DWORD exit_code; ::GetExitCodeProcess(handle, &exit_code); ::CloseHandle(handle); - if (exit_code == installer_util::RENAME_SUCCESSFUL) + if (exit_code == installer::RENAME_SUCCESSFUL) return true; } } diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index b6b9939..7d3f73e 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -44,7 +44,7 @@ using installer::Version; void AddChromeToMediaPlayerList() { std::wstring reg_path(installer::kMediaPlayerRegPath); // registry paths can also be appended like file system path - file_util::AppendToPath(®_path, installer_util::kChromeExe); + file_util::AppendToPath(®_path, installer::kChromeExe); VLOG(1) << "Adding Chrome to Media player list at " << reg_path; scoped_ptr<WorkItem> work_item(WorkItem::CreateCreateRegKeyWorkItem( HKEY_LOCAL_MACHINE, reg_path)); @@ -82,25 +82,25 @@ void AppendUninstallCommandLineFlags(CommandLine* uninstall_cmd, const Product& product) { DCHECK(uninstall_cmd); - uninstall_cmd->AppendSwitch(installer_util::switches::kUninstall); + uninstall_cmd->AppendSwitch(installer::switches::kUninstall); // Append the product-specific uninstall flags. product.distribution()->AppendUninstallCommandLineFlags(uninstall_cmd); if (product.IsMsi()) - uninstall_cmd->AppendSwitch(installer_util::switches::kMsi); + uninstall_cmd->AppendSwitch(installer::switches::kMsi); if (product.system_level()) - uninstall_cmd->AppendSwitch(installer_util::switches::kSystemLevel); + uninstall_cmd->AppendSwitch(installer::switches::kSystemLevel); // Propagate switches obtained from preferences as well. - const installer_util::MasterPreferences& prefs = - installer_util::MasterPreferences::ForCurrentProcess(); + const installer::MasterPreferences& prefs = + installer::MasterPreferences::ForCurrentProcess(); if (prefs.is_multi_install()) { - uninstall_cmd->AppendSwitch(installer_util::switches::kMultiInstall); + uninstall_cmd->AppendSwitch(installer::switches::kMultiInstall); } bool value = false; - if (prefs.GetBool(installer_util::master_preferences::kVerboseLogging, + if (prefs.GetBool(installer::master_preferences::kVerboseLogging, &value) && value) - uninstall_cmd->AppendSwitch(installer_util::switches::kVerboseLogging); + uninstall_cmd->AppendSwitch(installer::switches::kVerboseLogging); } // This method adds work items to create (or update) Chrome uninstall entry in @@ -132,9 +132,9 @@ void AddUninstallShortcutWorkItems(const FilePath& setup_path, std::wstring update_state_key(browser_dist->GetStateKey()); install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); install_list->AddSetRegValueWorkItem(reg_root, update_state_key, - installer_util::kUninstallStringField, installer_path.value(), true); + installer::kUninstallStringField, installer_path.value(), true); install_list->AddSetRegValueWorkItem(reg_root, update_state_key, - installer_util::kUninstallArgumentsField, + installer::kUninstallArgumentsField, uninstall_arguments.command_line_string(), true); // MSI installations will manage their own uninstall shortcuts. @@ -147,10 +147,10 @@ void AddUninstallShortcutWorkItems(const FilePath& setup_path, std::wstring uninstall_reg = browser_dist->GetUninstallRegPath(); install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, - installer_util::kUninstallDisplayNameField, + installer::kUninstallDisplayNameField, browser_dist->GetAppShortCutName(), true); install_list->AddSetRegValueWorkItem(reg_root, - uninstall_reg, installer_util::kUninstallStringField, + uninstall_reg, installer::kUninstallStringField, quoted_uninstall_cmd.command_line_string(), true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, @@ -159,7 +159,7 @@ void AddUninstallShortcutWorkItems(const FilePath& setup_path, true); // DisplayIcon, NoModify and NoRepair - FilePath chrome_icon(install_path.Append(installer_util::kChromeExe)); + FilePath chrome_icon(install_path.Append(installer::kChromeExe)); ShellUtil::GetChromeIcon(product.distribution(), chrome_icon.value()); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, L"DisplayIcon", chrome_icon.value(), @@ -234,7 +234,7 @@ void DeleteUninstallShortcutsForMSI(const Product& product) { void CopyPreferenceFileForFirstRun(const Package& package, const FilePath& prefs_source_path) { FilePath prefs_dest_path(package.path().AppendASCII( - installer_util::kDefaultMasterPrefs)); + installer::kDefaultMasterPrefs)); if (!file_util::CopyFile(prefs_source_path, prefs_dest_path)) { VLOG(1) << "Failed to copy master preferences from:" << prefs_source_path.value() << " gle: " << ::GetLastError(); @@ -257,14 +257,14 @@ void CopyPreferenceFileForFirstRun(const Package& package, // update. bool CreateOrUpdateChromeShortcuts(const FilePath& setup_path, const Version& new_version, - installer_util::InstallStatus install_status, + installer::InstallStatus install_status, const Product& product, bool create_all_shortcut, bool alt_shortcut) { // TODO(tommi): Change this function to use WorkItemList. #ifndef NDEBUG - const installer_util::MasterPreferences& prefs = - installer_util::MasterPreferences::ForCurrentProcess(); + const installer::MasterPreferences& prefs = + installer::MasterPreferences::ForCurrentProcess(); DCHECK(prefs.install_chrome()); #endif @@ -295,10 +295,10 @@ bool CreateOrUpdateChromeShortcuts(const FilePath& setup_path, chrome_link = chrome_link.Append(product_name + L".lnk"); // Chrome link target FilePath chrome_exe( - product.package().path().Append(installer_util::kChromeExe)); + product.package().path().Append(installer::kChromeExe)); - if ((install_status == installer_util::FIRST_INSTALL_SUCCESS) || - (install_status == installer_util::INSTALL_REPAIRED)) { + if ((install_status == installer::FIRST_INSTALL_SUCCESS) || + (install_status == installer::INSTALL_REPAIRED)) { if (!file_util::PathExists(shortcut_path)) file_util::CreateDirectoryW(shortcut_path); @@ -325,8 +325,8 @@ bool CreateOrUpdateChromeShortcuts(const FilePath& setup_path, FilePath uninstall_link(shortcut_path); // Uninstall Chrome link uninstall_link = uninstall_link.Append( browser_dist->GetUninstallLinkName() + L".lnk"); - if ((install_status == installer_util::FIRST_INSTALL_SUCCESS) || - (install_status == installer_util::INSTALL_REPAIRED) || + if ((install_status == installer::FIRST_INSTALL_SUCCESS) || + (install_status == installer::INSTALL_REPAIRED) || (file_util::PathExists(uninstall_link))) { if (!file_util::PathExists(shortcut_path)) file_util::CreateDirectory(shortcut_path); @@ -435,12 +435,12 @@ bool DoPostInstallTasks(const FilePath& setup_path, .Append(setup_path.BaseName())); CommandLine rename(installer_path); - rename.AppendSwitch(installer_util::switches::kRenameChromeExe); + rename.AppendSwitch(installer::switches::kRenameChromeExe); if (package.system_level()) - rename.AppendSwitch(installer_util::switches::kSystemLevel); + rename.AppendSwitch(installer::switches::kSystemLevel); if (InstallUtil::IsChromeSxSProcess()) - rename.AppendSwitch(installer_util::switches::kChromeSxS); + rename.AppendSwitch(installer::switches::kChromeSxS); for (size_t i = 0; i < products.size(); ++i) { BrowserDistribution* dist = products[i]->distribution(); @@ -542,7 +542,7 @@ void RegisterChromeOnMachine(const Product& product, // Is --make-chrome-default option is given we make Chrome default browser // otherwise we only register it on the machine as a valid browser. FilePath chrome_exe( - product.package().path().Append(installer_util::kChromeExe)); + product.package().path().Append(installer::kChromeExe)); VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value(); if (make_chrome_default) { int level = ShellUtil::CURRENT_USER; @@ -576,7 +576,7 @@ void RegisterChromeOnMachine(const Product& product, // package. If package does not exist before calling the function // (typical new install), the function creates package during install // and removes the whole directory during rollback. -installer_util::InstallStatus InstallNewVersion( +installer::InstallStatus InstallNewVersion( const FilePath& setup_path, const FilePath& archive_path, const FilePath& src_path, @@ -606,12 +606,12 @@ installer_util::InstallStatus InstallNewVersion( // Delete any new_chrome.exe if present (we will end up creating a new one // if required) and then copy chrome.exe FilePath new_chrome_exe( - package.path().Append(installer_util::kChromeNewExe)); + package.path().Append(installer::kChromeNewExe)); install_list->AddDeleteTreeWorkItem(new_chrome_exe); install_list->AddCopyTreeWorkItem( - src_path.Append(installer_util::kChromeExe).value(), - package.path().Append(installer_util::kChromeExe).value(), + src_path.Append(installer::kChromeExe).value(), + package.path().Append(installer::kChromeExe).value(), temp_dir.value(), WorkItem::NEW_NAME_IF_IN_USE, new_chrome_exe.value()); // Extra executable for 64 bit systems. @@ -644,7 +644,7 @@ installer_util::InstallStatus InstallNewVersion( // Delete any old_chrome.exe if present. install_list->AddDeleteTreeWorkItem( - package.path().Append(installer_util::kChromeOldExe)); + package.path().Append(installer::kChromeOldExe)); // Copy installer in install directory and // add shortcut in Control Panel->Add/Remove Programs. @@ -682,11 +682,11 @@ installer_util::InstallStatus InstallNewVersion( if (!install_list->Do() || !DoPostInstallTasks(setup_path, new_chrome_exe, current_version->get(), new_version, package)) { - installer_util::InstallStatus result = + installer::InstallStatus result = file_util::PathExists(new_chrome_exe) && current_version->get() && new_version.IsEqual(*current_version->get()) ? - installer_util::SAME_VERSION_REPAIR_FAILED : - installer_util::INSTALL_FAILED; + installer::SAME_VERSION_REPAIR_FAILED : + installer::INSTALL_FAILED; LOG(ERROR) << "Install failed, rolling back... result: " << result; install_list->Rollback(); LOG(ERROR) << "Rollback complete. "; @@ -695,39 +695,39 @@ installer_util::InstallStatus InstallNewVersion( if (!current_version->get()) { VLOG(1) << "First install of version " << new_version.GetString(); - return installer_util::FIRST_INSTALL_SUCCESS; + return installer::FIRST_INSTALL_SUCCESS; } if (new_version.IsEqual(*current_version->get())) { VLOG(1) << "Install repaired of version " << new_version.GetString(); - return installer_util::INSTALL_REPAIRED; + return installer::INSTALL_REPAIRED; } if (new_version.IsHigherThan(current_version->get())) { if (file_util::PathExists(new_chrome_exe)) { VLOG(1) << "Version updated to " << new_version.GetString() << " while running " << (*current_version)->GetString(); - return installer_util::IN_USE_UPDATED; + return installer::IN_USE_UPDATED; } VLOG(1) << "Version updated to " << new_version.GetString(); - return installer_util::NEW_VERSION_UPDATED; + return installer::NEW_VERSION_UPDATED; } LOG(ERROR) << "Not sure how we got here while updating" << ", new version: " << new_version.GetString() << ", old version: " << (*current_version)->GetString(); - return installer_util::INSTALL_FAILED; + return installer::INSTALL_FAILED; } } // end namespace namespace installer { -installer_util::InstallStatus InstallOrUpdateChrome( +installer::InstallStatus InstallOrUpdateChrome( const FilePath& setup_path, const FilePath& archive_path, const FilePath& install_temp_path, const FilePath& prefs_path, - const installer_util::MasterPreferences& prefs, const Version& new_version, + const installer::MasterPreferences& prefs, const Version& new_version, const Package& install) { bool system_install = install.system_level(); @@ -735,16 +735,16 @@ installer_util::InstallStatus InstallOrUpdateChrome( src_path = src_path.Append(kInstallSourceDir).Append(kInstallSourceChromeDir); scoped_ptr<Version> existing_version; - installer_util::InstallStatus result = InstallNewVersion(setup_path, + installer::InstallStatus result = InstallNewVersion(setup_path, archive_path, src_path, install_temp_path, new_version, &existing_version, install); if (!BrowserDistribution::GetInstallReturnCode(result)) { - if (result == installer_util::FIRST_INSTALL_SUCCESS) + if (result == installer::FIRST_INSTALL_SUCCESS) CopyPreferenceFileForFirstRun(install, prefs_path); bool do_not_create_shortcuts = false; - prefs.GetBool(installer_util::master_preferences::kDoNotCreateShortcuts, + prefs.GetBool(installer::master_preferences::kDoNotCreateShortcuts, &do_not_create_shortcuts); // Currently this only creates shortcuts for Chrome, but for other products @@ -753,10 +753,10 @@ installer_util::InstallStatus InstallOrUpdateChrome( FindProduct(install.products(), BrowserDistribution::CHROME_BROWSER); if (chrome_install && !do_not_create_shortcuts) { bool create_all_shortcut = false; - prefs.GetBool(installer_util::master_preferences::kCreateAllShortcuts, + prefs.GetBool(installer::master_preferences::kCreateAllShortcuts, &create_all_shortcut); bool alt_shortcut = false; - prefs.GetBool(installer_util::master_preferences::kAltShortcutText, + prefs.GetBool(installer::master_preferences::kAltShortcutText, &alt_shortcut); if (!CreateOrUpdateChromeShortcuts(setup_path, new_version, result, *chrome_install, create_all_shortcut, @@ -765,7 +765,7 @@ installer_util::InstallStatus InstallOrUpdateChrome( } bool make_chrome_default = false; - prefs.GetBool(installer_util::master_preferences::kMakeChromeDefault, + prefs.GetBool(installer::master_preferences::kMakeChromeDefault, &make_chrome_default); // If this is not the user's first Chrome install, but they have chosen @@ -773,10 +773,10 @@ installer_util::InstallStatus InstallOrUpdateChrome( // force it here because the master_preferences file will not get copied // into the build. bool force_chrome_default_for_user = false; - if (result == installer_util::NEW_VERSION_UPDATED || - result == installer_util::INSTALL_REPAIRED) { + if (result == installer::NEW_VERSION_UPDATED || + result == installer::INSTALL_REPAIRED) { prefs.GetBool( - installer_util::master_preferences::kMakeChromeDefaultForUser, + installer::master_preferences::kMakeChromeDefaultForUser, &force_chrome_default_for_user); } diff --git a/chrome/installer/setup/install.h b/chrome/installer/setup/install.h index bccb7e2..7a572b3b 100644 --- a/chrome/installer/setup/install.h +++ b/chrome/installer/setup/install.h @@ -39,10 +39,10 @@ class Package; // // Note: since caller unpacks Chrome to install_temp_path\source, the caller // is responsible for cleaning up install_temp_path. -installer_util::InstallStatus InstallOrUpdateChrome( +installer::InstallStatus InstallOrUpdateChrome( const FilePath& setup_path, const FilePath& archive_path, const FilePath& install_temp_path, const FilePath& prefs_path, - const installer_util::MasterPreferences& prefs, const Version& new_version, + const installer::MasterPreferences& prefs, const Version& new_version, const Package& package); // Registers or unregisters COM DLLs in a specific folder as declared in diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 239d4fa..4addd8c 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -50,7 +50,7 @@ using installer::Products; using installer::Package; using installer::Packages; using installer::Version; -using installer_util::MasterPreferences; +using installer::MasterPreferences; namespace { @@ -80,7 +80,7 @@ DWORD UnPackArchive(const FilePath& archive, FilePath uncompressed_archive(temp_path.Append(installer::kChromeArchive)); scoped_ptr<Version> archive_version( - setup_util::GetVersionFromArchiveDir(installation.path())); + installer::GetVersionFromArchiveDir(installation.path())); // Check if this is differential update and if it is, patch it to the // installer archive that should already be on the machine. We assume @@ -91,14 +91,14 @@ DWORD UnPackArchive(const FilePath& archive, if (!archive_version.get()) { LOG(ERROR) << "Can not use differential update when Chrome is not " << "installed on the system."; - return installer_util::CHROME_NOT_INSTALLED; + return installer::CHROME_NOT_INSTALLED; } FilePath existing_archive( installation.path().Append(archive_version->GetString())); - existing_archive = existing_archive.Append(installer_util::kInstallerDir); + existing_archive = existing_archive.Append(installer::kInstallerDir); existing_archive = existing_archive.Append(installer::kChromeArchive); - if (int i = setup_util::ApplyDiffPatch(FilePath(existing_archive), + if (int i = installer::ApplyDiffPatch(FilePath(existing_archive), FilePath(unpacked_file), FilePath(uncompressed_archive))) { LOG(ERROR) << "Binary patching failed with error " << i; @@ -117,20 +117,20 @@ DWORD UnPackArchive(const FilePath& archive, // for Chrome so there should be a file called new_chrome.exe on the file // system and a key called 'opv' in the registry. This function will move // new_chrome.exe to chrome.exe and delete 'opv' key in one atomic operation. -installer_util::InstallStatus RenameChromeExecutables( +installer::InstallStatus RenameChromeExecutables( const Package& installation) { - FilePath chrome_exe(installation.path().Append(installer_util::kChromeExe)); + FilePath chrome_exe(installation.path().Append(installer::kChromeExe)); FilePath chrome_old_exe(installation.path().Append( - installer_util::kChromeOldExe)); + installer::kChromeOldExe)); FilePath chrome_new_exe(installation.path().Append( - installer_util::kChromeNewExe)); + installer::kChromeNewExe)); scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); install_list->AddDeleteTreeWorkItem(chrome_old_exe); FilePath temp_path; if (!file_util::CreateNewTempDirectory(L"chrome_", &temp_path)) { LOG(ERROR) << "Failed to create Temp directory " << temp_path.value(); - return installer_util::RENAME_FAILED; + return installer::RENAME_FAILED; } install_list->AddCopyTreeWorkItem(chrome_new_exe.value(), @@ -156,18 +156,18 @@ installer_util::InstallStatus RenameChromeExecutables( google_update::kRegRenameCmdField, true); } - installer_util::InstallStatus ret = installer_util::RENAME_SUCCESSFUL; + installer::InstallStatus ret = installer::RENAME_SUCCESSFUL; if (!install_list->Do()) { LOG(ERROR) << "Renaming of executables failed. Rolling back any changes."; install_list->Rollback(); - ret = installer_util::RENAME_FAILED; + ret = installer::RENAME_FAILED; } file_util::Delete(temp_path, true); return ret; } bool CheckPreInstallConditions(const Package& installation, - installer_util::InstallStatus& status) { + installer::InstallStatus& status) { const Products& products = installation.products(); DCHECK(products.size()); @@ -197,12 +197,12 @@ bool CheckPreInstallConditions(const Package& installation, !product->system_level(), browser_dist)); if (chrome_exe.empty()) { // If we failed to construct install path. Give up. - status = installer_util::OS_ERROR; + status = installer::OS_ERROR; product->WriteInstallerResult(status, IDS_INSTALL_OS_ERROR_BASE, NULL); } else { - status = installer_util::EXISTING_VERSION_LAUNCHED; - chrome_exe = chrome_exe.Append(installer_util::kChromeExe); + status = installer::EXISTING_VERSION_LAUNCHED; + chrome_exe = chrome_exe.Append(installer::kChromeExe); CommandLine cmd(chrome_exe); cmd.AppendSwitch(switches::kFirstRun); product->WriteInstallerResult(status, 0, NULL); @@ -215,14 +215,14 @@ bool CheckPreInstallConditions(const Package& installation, // If the following compile assert fires it means that the InstallStatus // enumeration changed which will break the contract between the old // chrome installed and the new setup.exe that is trying to upgrade. - COMPILE_ASSERT(installer_util::SXS_OPTION_NOT_SUPPORTED == 33, + COMPILE_ASSERT(installer::SXS_OPTION_NOT_SUPPORTED == 33, dont_change_enum); // This is an update, not an install. Omaha should know the difference // and not show a dialog. status = product->system_level() ? - installer_util::USER_LEVEL_INSTALL_EXISTS : - installer_util::SYSTEM_LEVEL_INSTALL_EXISTS; + installer::USER_LEVEL_INSTALL_EXISTS : + installer::SYSTEM_LEVEL_INSTALL_EXISTS; int str_id = product->system_level() ? IDS_INSTALL_USER_LEVEL_EXISTS_BASE : IDS_INSTALL_SYSTEM_LEVEL_EXISTS_BASE; @@ -239,7 +239,7 @@ bool CheckPreInstallConditions(const Package& installation, !file_util::Delete(installation.path(), true)) { LOG(ERROR) << "Installation directory " << installation.path().value() << " exists and can not be deleted."; - status = installer_util::INSTALL_DIR_IN_USE; + status = installer::INSTALL_DIR_IN_USE; int str_id = IDS_INSTALL_DIR_IN_USE_BASE; WriteInstallerResult(products, status, str_id, NULL); return false; @@ -249,9 +249,9 @@ bool CheckPreInstallConditions(const Package& installation, return true; } -installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, +installer::InstallStatus InstallChrome(const CommandLine& cmd_line, const Package& installation, const MasterPreferences& prefs) { - installer_util::InstallStatus install_status = installer_util::UNKNOWN_STATUS; + installer::InstallStatus install_status = installer::UNKNOWN_STATUS; if (!CheckPreInstallConditions(installation, install_status)) return install_status; @@ -261,9 +261,9 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, installer::kChromeCompressedArchive)); // If --install-archive is given, get the user specified value - if (cmd_line.HasSwitch(installer_util::switches::kInstallArchive)) { + if (cmd_line.HasSwitch(installer::switches::kInstallArchive)) { archive = cmd_line.GetSwitchValuePath( - installer_util::switches::kInstallArchive); + installer::switches::kInstallArchive); } VLOG(1) << "Archive found to install Chrome " << archive.value(); bool system_level = installation.system_level(); @@ -274,9 +274,9 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, FilePath temp_path; if (!file_util::CreateNewTempDirectory(L"chrome_", &temp_path)) { LOG(ERROR) << "Could not create temporary path."; - WriteInstallerResult(products, installer_util::TEMP_DIR_FAILED, + WriteInstallerResult(products, installer::TEMP_DIR_FAILED, IDS_INSTALL_TEMP_DIR_FAILED_BASE, NULL); - return installer_util::TEMP_DIR_FAILED; + return installer::TEMP_DIR_FAILED; } VLOG(1) << "created path " << temp_path.value(); @@ -284,17 +284,17 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, bool incremental_install = false; if (UnPackArchive(archive, installation, temp_path, unpack_path, incremental_install)) { - install_status = installer_util::UNCOMPRESSION_FAILED; + install_status = installer::UNCOMPRESSION_FAILED; WriteInstallerResult(products, install_status, IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, NULL); } else { VLOG(1) << "unpacked to " << unpack_path.value(); FilePath src_path(unpack_path.Append(installer::kInstallSourceChromeDir)); scoped_ptr<Version> - installer_version(setup_util::GetVersionFromArchiveDir(src_path)); + installer_version(installer::GetVersionFromArchiveDir(src_path)); if (!installer_version.get()) { LOG(ERROR) << "Did not find any valid version in installer."; - install_status = installer_util::INVALID_ARCHIVE; + install_status = installer::INVALID_ARCHIVE; WriteInstallerResult(products, install_status, IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); } else { @@ -311,7 +311,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, if (v.get() && v->IsHigherThan(installer_version.get())) { LOG(ERROR) << "Higher version is already installed."; higher_version_installed = true; - install_status = installer_util::HIGHER_VERSION_EXISTS; + install_status = installer::HIGHER_VERSION_EXISTS; if (product->distribution()->GetType() != BrowserDistribution::CHROME_BROWSER) { @@ -331,28 +331,28 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, // uncompressing and binary patching. Get the location for this file. FilePath archive_to_copy(temp_path.Append(installer::kChromeArchive)); FilePath prefs_source_path(cmd_line.GetSwitchValueNative( - installer_util::switches::kInstallerData)); + installer::switches::kInstallerData)); install_status = installer::InstallOrUpdateChrome(cmd_line.GetProgram(), archive_to_copy, temp_path, prefs_source_path, prefs, *installer_version, installation); int install_msg_base = IDS_INSTALL_FAILED_BASE; std::wstring chrome_exe; - if (install_status == installer_util::SAME_VERSION_REPAIR_FAILED) { + if (install_status == installer::SAME_VERSION_REPAIR_FAILED) { if (FindProduct(products, BrowserDistribution::CHROME_FRAME)) { install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_CF_BASE; } else { install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE; } - } else if (install_status != installer_util::INSTALL_FAILED) { + } else if (install_status != installer::INSTALL_FAILED) { if (installation.path().empty()) { // If we failed to construct install path, it means the OS call to // get %ProgramFiles% or %AppData% failed. Report this as failure. install_msg_base = IDS_INSTALL_OS_ERROR_BASE; - install_status = installer_util::OS_ERROR; + install_status = installer::OS_ERROR; } else { chrome_exe = installation.path() - .Append(installer_util::kChromeExe).value(); + .Append(installer::kChromeExe).value(); chrome_exe = L"\"" + chrome_exe + L"\""; install_msg_base = 0; } @@ -364,31 +364,31 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, bool value = false; if (chrome_install) { prefs.GetBool( - installer_util::master_preferences::kDoNotRegisterForUpdateLaunch, + installer::master_preferences::kDoNotRegisterForUpdateLaunch, &value); } else { value = true; // Never register. } bool write_chrome_launch_string = (!value) && - (install_status != installer_util::IN_USE_UPDATED); + (install_status != installer::IN_USE_UPDATED); WriteInstallerResult(products, install_status, install_msg_base, write_chrome_launch_string ? &chrome_exe : NULL); - if (install_status == installer_util::FIRST_INSTALL_SUCCESS) { + if (install_status == installer::FIRST_INSTALL_SUCCESS) { VLOG(1) << "First install successful."; if (chrome_install) { // We never want to launch Chrome in system level install mode. bool do_not_launch_chrome = false; prefs.GetBool( - installer_util::master_preferences::kDoNotLaunchChrome, + installer::master_preferences::kDoNotLaunchChrome, &do_not_launch_chrome); if (!chrome_install->system_level() && !do_not_launch_chrome) chrome_install->LaunchChrome(); } - } else if ((install_status == installer_util::NEW_VERSION_UPDATED) || - (install_status == installer_util::IN_USE_UPDATED)) { + } else if ((install_status == installer::NEW_VERSION_UPDATED) || + (install_status == installer::IN_USE_UPDATED)) { for (size_t i = 0; i < products.size(); ++i) { installer::RemoveLegacyRegistryKeys( products[i]->distribution()); @@ -416,9 +416,9 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, // such, we do not use DeleteTreeWorkItem. VLOG(1) << "Deleting temporary directory " << temp_path.value(); bool cleanup_success = file_util::Delete(temp_path, true); - if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) { + if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { std::wstring prefs_path = cmd_line.GetSwitchValueNative( - installer_util::switches::kInstallerData); + installer::switches::kInstallerData); cleanup_success = file_util::Delete(prefs_path, true) && cleanup_success; } @@ -430,9 +430,9 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, // deletion at next reboot. if (!cleanup_success) { ScheduleDirectoryForDeletion(temp_path.ToWStringHack().c_str()); - if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) { + if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { std::wstring prefs_path = cmd_line.GetSwitchValueNative( - installer_util::switches::kInstallerData); + installer::switches::kInstallerData); ScheduleDirectoryForDeletion(prefs_path.c_str()); } } @@ -446,7 +446,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, return install_status; } -installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line, +installer::InstallStatus UninstallChrome(const CommandLine& cmd_line, const Product& product) { VLOG(1) << "Uninstalling Chome"; @@ -454,27 +454,27 @@ installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line, if (installed_version.get()) VLOG(1) << "version on the system: " << installed_version->GetString(); - bool force = cmd_line.HasSwitch(installer_util::switches::kForceUninstall); + bool force = cmd_line.HasSwitch(installer::switches::kForceUninstall); if (!installed_version.get() && !force) { LOG(ERROR) << "No Chrome installation found for uninstall."; - product.WriteInstallerResult(installer_util::CHROME_NOT_INSTALLED, + product.WriteInstallerResult(installer::CHROME_NOT_INSTALLED, IDS_UNINSTALL_FAILED_BASE, NULL); - return installer_util::CHROME_NOT_INSTALLED; + return installer::CHROME_NOT_INSTALLED; } bool remove_all = !cmd_line.HasSwitch( - installer_util::switches::kDoNotRemoveSharedItems); + installer::switches::kDoNotRemoveSharedItems); return installer::UninstallChrome(cmd_line.GetProgram(), product, remove_all, force, cmd_line); } -installer_util::InstallStatus ShowEULADialog(const std::wstring& inner_frame) { +installer::InstallStatus ShowEULADialog(const std::wstring& inner_frame) { VLOG(1) << "About to show EULA"; - std::wstring eula_path = installer_util::GetLocalizedEulaResource(); + std::wstring eula_path = installer::GetLocalizedEulaResource(); if (eula_path.empty()) { LOG(ERROR) << "No EULA path available"; - return installer_util::EULA_REJECTED; + return installer::EULA_REJECTED; } // Newer versions of the caller pass an inner frame parameter that must // be given to the html page being launched. @@ -486,14 +486,14 @@ installer_util::InstallStatus ShowEULADialog(const std::wstring& inner_frame) { installer::EulaHTMLDialog::Outcome outcome = dlg.ShowModal(); if (installer::EulaHTMLDialog::REJECTED == outcome) { LOG(ERROR) << "EULA rejected or EULA failure"; - return installer_util::EULA_REJECTED; + return installer::EULA_REJECTED; } if (installer::EulaHTMLDialog::ACCEPTED_OPT_IN == outcome) { VLOG(1) << "EULA accepted (opt-in)"; - return installer_util::EULA_ACCEPTED_OPT_IN; + return installer::EULA_ACCEPTED_OPT_IN; } VLOG(1) << "EULA accepted (no opt-in)"; - return installer_util::EULA_ACCEPTED; + return installer::EULA_ACCEPTED; } // This method processes any command line options that make setup.exe do @@ -504,8 +504,8 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, int& exit_code, const ProductPackageMapping& installs) { DCHECK(installs.products().size()); - if (cmd_line.HasSwitch(installer_util::switches::kUpdateSetupExe)) { - installer_util::InstallStatus status = installer_util::SETUP_PATCH_FAILED; + if (cmd_line.HasSwitch(installer::switches::kUpdateSetupExe)) { + installer::InstallStatus status = installer::SETUP_PATCH_FAILED; // If --update-setup-exe command line option is given, we apply the given // patch to current exe, and store the resulting binary in the path // specified by --new-setup-exe. But we need to first unpack the file @@ -515,18 +515,18 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, LOG(ERROR) << "Could not create temporary path."; } else { std::wstring setup_patch = cmd_line.GetSwitchValueNative( - installer_util::switches::kUpdateSetupExe); + installer::switches::kUpdateSetupExe); VLOG(1) << "Opening archive " << setup_patch; std::wstring uncompressed_patch; if (LzmaUtil::UnPackArchive(setup_patch, temp_path.ToWStringHack(), &uncompressed_patch) == NO_ERROR) { FilePath old_setup_exe = cmd_line.GetProgram(); FilePath new_setup_exe = cmd_line.GetSwitchValuePath( - installer_util::switches::kNewSetupExe); - if (!setup_util::ApplyDiffPatch(old_setup_exe, + installer::switches::kNewSetupExe); + if (!installer::ApplyDiffPatch(old_setup_exe, FilePath(uncompressed_patch), new_setup_exe)) - status = installer_util::NEW_VERSION_UPDATED; + status = installer::NEW_VERSION_UPDATED; } } @@ -538,17 +538,17 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, } file_util::Delete(temp_path, true); return true; - } else if (cmd_line.HasSwitch(installer_util::switches::kShowEula)) { + } else if (cmd_line.HasSwitch(installer::switches::kShowEula)) { // Check if we need to show the EULA. If it is passed as a command line // then the dialog is shown and regardless of the outcome setup exits here. std::wstring inner_frame = - cmd_line.GetSwitchValueNative(installer_util::switches::kShowEula); + cmd_line.GetSwitchValueNative(installer::switches::kShowEula); exit_code = ShowEULADialog(inner_frame); - if (installer_util::EULA_REJECTED != exit_code) + if (installer::EULA_REJECTED != exit_code) GoogleUpdateSettings::SetEULAConsent(true); return true; } else if (cmd_line.HasSwitch( - installer_util::switches::kRegisterChromeBrowser)) { + installer::switches::kRegisterChromeBrowser)) { const Product* chrome_install = FindProduct(installs.products(), BrowserDistribution::CHROME_BROWSER); DCHECK(chrome_install); @@ -559,21 +559,21 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, // be used when setup.exe is launched with admin rights. We do not // make any user specific changes in this option. std::wstring chrome_exe(cmd_line.GetSwitchValueNative( - installer_util::switches::kRegisterChromeBrowser)); + installer::switches::kRegisterChromeBrowser)); std::wstring suffix; if (cmd_line.HasSwitch( - installer_util::switches::kRegisterChromeBrowserSuffix)) { + installer::switches::kRegisterChromeBrowserSuffix)) { suffix = cmd_line.GetSwitchValueNative( - installer_util::switches::kRegisterChromeBrowserSuffix); + installer::switches::kRegisterChromeBrowserSuffix); } exit_code = ShellUtil::RegisterChromeBrowser( chrome_install->distribution(), chrome_exe, suffix, false); } else { LOG(ERROR) << "Can't register browser - Chrome distribution not found"; - exit_code = installer_util::UNKNOWN_STATUS; + exit_code = installer::UNKNOWN_STATUS; } return true; - } else if (cmd_line.HasSwitch(installer_util::switches::kRenameChromeExe)) { + } else if (cmd_line.HasSwitch(installer::switches::kRenameChromeExe)) { // If --rename-chrome-exe is specified, we want to rename the executables // and exit. const Packages& packages = installs.packages(); @@ -582,18 +582,18 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, exit_code = RenameChromeExecutables(*packages[i].get()); return true; } else if (cmd_line.HasSwitch( - installer_util::switches::kRemoveChromeRegistration)) { + installer::switches::kRemoveChromeRegistration)) { // This is almost reverse of --register-chrome-browser option above. // Here we delete Chrome browser registration. This option should only // be used when setup.exe is launched with admin rights. We do not // make any user specific changes in this option. std::wstring suffix; if (cmd_line.HasSwitch( - installer_util::switches::kRegisterChromeBrowserSuffix)) { + installer::switches::kRegisterChromeBrowserSuffix)) { suffix = cmd_line.GetSwitchValueNative( - installer_util::switches::kRegisterChromeBrowserSuffix); + installer::switches::kRegisterChromeBrowserSuffix); } - installer_util::InstallStatus tmp = installer_util::UNKNOWN_STATUS; + installer::InstallStatus tmp = installer::UNKNOWN_STATUS; const Product* chrome_install = FindProduct(installs.products(), BrowserDistribution::CHROME_BROWSER); DCHECK(chrome_install); @@ -603,14 +603,14 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, } exit_code = tmp; return true; - } else if (cmd_line.HasSwitch(installer_util::switches::kInactiveUserToast)) { + } else if (cmd_line.HasSwitch(installer::switches::kInactiveUserToast)) { // Launch the inactive user toast experiment. int flavor = -1; base::StringToInt(cmd_line.GetSwitchValueNative( - installer_util::switches::kInactiveUserToast), &flavor); + installer::switches::kInactiveUserToast), &flavor); DCHECK_NE(-1, flavor); if (flavor == -1) { - exit_code = installer_util::UNKNOWN_STATUS; + exit_code = installer::UNKNOWN_STATUS; } else { const Products& products = installs.products(); for (size_t i = 0; i < products.size(); ++i) { @@ -620,7 +620,7 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, } } return true; - } else if (cmd_line.HasSwitch(installer_util::switches::kSystemLevelToast)) { + } else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { const Products& products = installs.products(); for (size_t i = 0; i < products.size(); ++i) { const Product* product = products[i]; @@ -629,7 +629,7 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, // to continue with the toast experiment. scoped_ptr<Version> installed_version( InstallUtil::GetChromeVersion(browser_dist, installs.system_level())); - browser_dist->LaunchUserExperiment(installer_util::REENTRY_SYS_UPDATE, + browser_dist->LaunchUserExperiment(installer::REENTRY_SYS_UPDATE, *installed_version, *product, true); } return true; @@ -714,14 +714,14 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, CommandLine::Init(0, NULL); const MasterPreferences& prefs = - installer_util::MasterPreferences::ForCurrentProcess(); + installer::MasterPreferences::ForCurrentProcess(); installer::InitInstallerLogging(prefs); const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); VLOG(1) << "Command Line: " << cmd_line.command_line_string(); bool system_install = false; - prefs.GetBool(installer_util::master_preferences::kSystemLevel, + prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); VLOG(1) << "system install is " << system_install; @@ -733,30 +733,30 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, if (!InstallUtil::IsOSSupported()) { LOG(ERROR) << "Chrome only supports Windows XP or later."; WriteInstallerResult(installations.products(), - installer_util::OS_NOT_SUPPORTED, IDS_INSTALL_OS_NOT_SUPPORTED_BASE, + installer::OS_NOT_SUPPORTED, IDS_INSTALL_OS_NOT_SUPPORTED_BASE, NULL); - return installer_util::OS_NOT_SUPPORTED; + return installer::OS_NOT_SUPPORTED; } // Initialize COM for use later. AutoCom auto_com; if (!auto_com.Init(system_install)) { WriteInstallerResult(installations.products(), - installer_util::OS_ERROR, IDS_INSTALL_OS_ERROR_BASE, NULL); - return installer_util::OS_ERROR; + installer::OS_ERROR, IDS_INSTALL_OS_ERROR_BASE, NULL); + return installer::OS_ERROR; } // Some command line options don't work with SxS install/uninstall if (InstallUtil::IsChromeSxSProcess()) { if (system_install || - cmd_line.HasSwitch(installer_util::switches::kForceUninstall) || - cmd_line.HasSwitch(installer_util::switches::kMakeChromeDefault) || - cmd_line.HasSwitch(installer_util::switches::kRegisterChromeBrowser) || + cmd_line.HasSwitch(installer::switches::kForceUninstall) || + cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || + cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser) || cmd_line.HasSwitch( - installer_util::switches::kRemoveChromeRegistration) || - cmd_line.HasSwitch(installer_util::switches::kInactiveUserToast) || - cmd_line.HasSwitch(installer_util::switches::kSystemLevelToast)) { - return installer_util::SXS_OPTION_NOT_SUPPORTED; + installer::switches::kRemoveChromeRegistration) || + cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || + cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { + return installer::SXS_OPTION_NOT_SUPPORTED; } } @@ -766,27 +766,27 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, if (system_install && !IsUserAnAdmin()) { if (base::win::GetVersion() >= base::win::VERSION_VISTA && - !cmd_line.HasSwitch(installer_util::switches::kRunAsAdmin)) { + !cmd_line.HasSwitch(installer::switches::kRunAsAdmin)) { CommandLine new_cmd(CommandLine::NO_PROGRAM); new_cmd.AppendArguments(cmd_line, true); // Append --run-as-admin flag to let the new instance of setup.exe know // that we already tried to launch ourselves as admin. - new_cmd.AppendSwitch(installer_util::switches::kRunAsAdmin); - DWORD exit_code = installer_util::UNKNOWN_STATUS; + new_cmd.AppendSwitch(installer::switches::kRunAsAdmin); + DWORD exit_code = installer::UNKNOWN_STATUS; InstallUtil::ExecuteExeAsAdmin(new_cmd, &exit_code); return exit_code; } else { LOG(ERROR) << "Non admin user can not install system level Chrome."; WriteInstallerResult(installations.products(), - installer_util::INSUFFICIENT_RIGHTS, + installer::INSUFFICIENT_RIGHTS, IDS_INSTALL_INSUFFICIENT_RIGHTS_BASE, NULL); - return installer_util::INSUFFICIENT_RIGHTS; + return installer::INSUFFICIENT_RIGHTS; } } - bool is_uninstall = cmd_line.HasSwitch(installer_util::switches::kUninstall); + bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall); - installer_util::InstallStatus install_status = installer_util::UNKNOWN_STATUS; + installer::InstallStatus install_status = installer::UNKNOWN_STATUS; // If --uninstall option is given, uninstall chrome if (is_uninstall) { DCHECK_EQ(1U, installations.products().size()) << @@ -809,12 +809,12 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, FindProduct(installations.products(), BrowserDistribution::CHROME_FRAME); if (cf_install && - !cmd_line.HasSwitch(installer_util::switches::kForceUninstall)) { - if (install_status == installer_util::UNINSTALL_REQUIRES_REBOOT) { + !cmd_line.HasSwitch(installer::switches::kForceUninstall)) { + if (install_status == installer::UNINSTALL_REQUIRES_REBOOT) { ShowRebootDialog(); } else if (is_uninstall) { ::MessageBoxW(NULL, - installer_util::GetLocalizedString( + installer::GetLocalizedString( IDS_UNINSTALL_COMPLETE_BASE).c_str(), cf_install->distribution()->GetApplicationName().c_str(), MB_OK); @@ -830,7 +830,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, for (size_t i = 0; i < installations.products().size(); ++i) { const Product* product = installations.products()[i]; if (!(product->IsMsi() && is_uninstall)) { - // Note that we allow the status installer_util::UNINSTALL_REQUIRES_REBOOT + // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT // to pass through, since this is only returned on uninstall which is // never invoked directly by Google Update. return_code = BrowserDistribution::GetInstallReturnCode(install_status); diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc index 08ea157..16e0af1 100644 --- a/chrome/installer/setup/setup_util.cc +++ b/chrome/installer/setup/setup_util.cc @@ -13,7 +13,7 @@ #include "courgette/courgette.h" #include "third_party/bspatch/mbspatch.h" -int setup_util::ApplyDiffPatch(const FilePath& src, +int installer::ApplyDiffPatch(const FilePath& src, const FilePath& patch, const FilePath& dest) { VLOG(1) << "Applying patch " << patch.value() << " to file " << src.value() @@ -33,7 +33,7 @@ int setup_util::ApplyDiffPatch(const FilePath& src, dest.value().c_str()); } -installer::Version* setup_util::GetVersionFromArchiveDir( +installer::Version* installer::GetVersionFromArchiveDir( const FilePath& chrome_path) { VLOG(1) << "Looking for Chrome version folder under " << chrome_path.value(); FilePath root_path = chrome_path.Append(L"*"); diff --git a/chrome/installer/setup/setup_util.h b/chrome/installer/setup/setup_util.h index 0858070..468ed62 100644 --- a/chrome/installer/setup/setup_util.h +++ b/chrome/installer/setup/setup_util.h @@ -12,7 +12,7 @@ class FilePath; -namespace setup_util { +namespace installer { // Apply a diff patch to source file. First tries to apply it using courgette // since it checks for courgette header and fails quickly. If that fails // tries to apply the patch using regular bsdiff. Returns status code. @@ -24,6 +24,6 @@ namespace setup_util { // Chrome_path should contain a version folder. // Returns the first version found or NULL if no version is found. installer::Version* GetVersionFromArchiveDir(const FilePath& chrome_path); -} // namespace setup_util +} // namespace installer #endif // CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index 8161173..72e40ed 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc @@ -49,11 +49,11 @@ TEST_F(SetupUtilTest, ApplyDiffPatchTest) { FilePath src = data_dir_.AppendASCII("archive1.7z"); FilePath patch = data_dir_.AppendASCII("archive.diff"); FilePath dest = work_dir.AppendASCII("archive2.7z"); - EXPECT_EQ(setup_util::ApplyDiffPatch(src, patch, dest), 0); + EXPECT_EQ(installer::ApplyDiffPatch(src, patch, dest), 0); FilePath base = data_dir_.AppendASCII("archive2.7z"); EXPECT_TRUE(file_util::ContentsEqual(dest, base)); - EXPECT_EQ(setup_util::ApplyDiffPatch(FilePath(), FilePath(), FilePath()), 6); + EXPECT_EQ(installer::ApplyDiffPatch(FilePath(), FilePath(), FilePath()), 6); } // Test that we are parsing Chrome version correctly. @@ -63,21 +63,21 @@ TEST_F(SetupUtilTest, GetVersionFromArchiveDirTest) { file_util::CreateDirectory(chrome_dir); ASSERT_TRUE(file_util::PathExists(chrome_dir)); scoped_ptr<installer::Version> version( - setup_util::GetVersionFromArchiveDir(test_dir_.path())); + installer::GetVersionFromArchiveDir(test_dir_.path())); ASSERT_TRUE(version->GetString() == L"1.0.0.0"); file_util::Delete(chrome_dir, true); ASSERT_FALSE(file_util::PathExists(chrome_dir)); - ASSERT_TRUE(setup_util::GetVersionFromArchiveDir(test_dir_.path()) == NULL); + ASSERT_TRUE(installer::GetVersionFromArchiveDir(test_dir_.path()) == NULL); chrome_dir = test_dir_.path().AppendASCII("ABC"); file_util::CreateDirectory(chrome_dir); ASSERT_TRUE(file_util::PathExists(chrome_dir)); - ASSERT_TRUE(setup_util::GetVersionFromArchiveDir(test_dir_.path()) == NULL); + ASSERT_TRUE(installer::GetVersionFromArchiveDir(test_dir_.path()) == NULL); chrome_dir = test_dir_.path().AppendASCII("2.3.4.5"); file_util::CreateDirectory(chrome_dir); ASSERT_TRUE(file_util::PathExists(chrome_dir)); - version.reset(setup_util::GetVersionFromArchiveDir(test_dir_.path())); + version.reset(installer::GetVersionFromArchiveDir(test_dir_.path())); ASSERT_TRUE(version->GetString() == L"2.3.4.5"); } diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 4ef2103..07925a0 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -32,7 +32,7 @@ #include "registered_dlls.h" // NOLINT using base::win::RegKey; -using installer_util::InstallStatus; +using installer::InstallStatus; namespace installer { @@ -51,9 +51,9 @@ void CloseAllChromeProcesses() { window = FindWindowEx(NULL, window, wnd_class.c_str(), NULL); if (!SendMessageTimeout(tmpWnd, WM_CLOSE, 0, 0, SMTO_BLOCK, 3000, NULL) && (GetLastError() == ERROR_TIMEOUT)) { - base::CleanupProcesses(installer_util::kChromeExe, 0, + base::CleanupProcesses(installer::kChromeExe, 0, ResultCodes::HUNG, NULL); - base::CleanupProcesses(installer_util::kNaClExe, 0, + base::CleanupProcesses(installer::kNaClExe, 0, ResultCodes::HUNG, NULL); return; } @@ -63,16 +63,16 @@ void CloseAllChromeProcesses() { // If asking politely didn't work, wait for 15 seconds and then kill all // chrome.exe. This check is just in case Chrome is ignoring WM_CLOSE // messages. - base::CleanupProcesses(installer_util::kChromeExe, 15000, + base::CleanupProcesses(installer::kChromeExe, 15000, ResultCodes::HUNG, NULL); - base::CleanupProcesses(installer_util::kNaClExe, 15000, + base::CleanupProcesses(installer::kNaClExe, 15000, ResultCodes::HUNG, NULL); } // Attempts to close the Chrome Frame helper process by sending WM_CLOSE // messages to its window, or just killing it if that doesn't work. void CloseChromeFrameHelperProcess() { - HWND window = FindWindow(installer_util::kChromeFrameHelperWndClass, NULL); + HWND window = FindWindow(installer::kChromeFrameHelperWndClass, NULL); if (!::IsWindow(window)) return; @@ -87,20 +87,20 @@ void CloseChromeFrameHelperProcess() { bool kill = true; if (SendMessageTimeout(window, WM_CLOSE, 0, 0, SMTO_BLOCK, kWaitMs, NULL) && process) { - VLOG(1) << "Waiting for " << installer_util::kChromeFrameHelperExe; + VLOG(1) << "Waiting for " << installer::kChromeFrameHelperExe; DWORD wait = ::WaitForSingleObject(process, kWaitMs); if (wait != WAIT_OBJECT_0) { - LOG(WARNING) << "Wait for " << installer_util::kChromeFrameHelperExe + LOG(WARNING) << "Wait for " << installer::kChromeFrameHelperExe << " to exit failed or timed out."; } else { kill = false; - VLOG(1) << installer_util::kChromeFrameHelperExe << " exited normally."; + VLOG(1) << installer::kChromeFrameHelperExe << " exited normally."; } } if (kill) { - VLOG(1) << installer_util::kChromeFrameHelperExe << " hung. Killing."; - base::CleanupProcesses(installer_util::kChromeFrameHelperExe, 0, + VLOG(1) << installer::kChromeFrameHelperExe << " hung. Killing."; + base::CleanupProcesses(installer::kChromeFrameHelperExe, 0, ResultCodes::HUNG, NULL); } } @@ -117,7 +117,7 @@ bool CurrentUserHasDefaultBrowser(const Product& product) { std::wstring reg_exe; if (key.ReadValue(L"", ®_exe) && reg_exe.length() > 2) { FilePath chrome_exe(product.package().path() - .Append(installer_util::kChromeExe)); + .Append(installer::kChromeExe)); // The path in the registry will always have quotes. reg_exe = reg_exe.substr(1, reg_exe.length() - 2); if (FilePath::CompareEqualIgnoreCase(reg_exe, chrome_exe.value())) @@ -341,7 +341,7 @@ DeleteResult DeleteFilesAndFolders(const Package& package, InstallStatus IsChromeActiveOrUserCancelled(const Product& product) { int32 exit_code = ResultCodes::NORMAL_EXIT; CommandLine options(CommandLine::NO_PROGRAM); - options.AppendSwitch(installer_util::switches::kUninstall); + options.AppendSwitch(installer::switches::kUninstall); // Here we want to save user from frustration (in case of Chrome crashes) // and continue with the uninstallation as long as chrome.exe process exit @@ -358,15 +358,15 @@ InstallStatus IsChromeActiveOrUserCancelled(const Product& product) { if ((exit_code == ResultCodes::UNINSTALL_CHROME_ALIVE) || (exit_code == ResultCodes::UNINSTALL_USER_CANCEL) || (exit_code == ResultCodes::HUNG)) - return installer_util::UNINSTALL_CANCELLED; + return installer::UNINSTALL_CANCELLED; if (exit_code == ResultCodes::UNINSTALL_DELETE_PROFILE) - return installer_util::UNINSTALL_DELETE_PROFILE; + return installer::UNINSTALL_DELETE_PROFILE; } else { PLOG(ERROR) << "Failed to launch chrome.exe for uninstall confirmation."; } - return installer_util::UNINSTALL_CONFIRMED; + return installer::UNINSTALL_CONFIRMED; } bool ShouldDeleteProfile(const CommandLine& cmd_line, InstallStatus status, @@ -382,8 +382,8 @@ bool ShouldDeleteProfile(const CommandLine& cmd_line, InstallStatus status, should_delete = true; } else { should_delete = - status == installer_util::UNINSTALL_DELETE_PROFILE || - cmd_line.HasSwitch(installer_util::switches::kDeleteProfile); + status == installer::UNINSTALL_DELETE_PROFILE || + cmd_line.HasSwitch(installer::switches::kDeleteProfile); } return should_delete; @@ -418,7 +418,7 @@ bool DeleteChromeRegistrationKeys(BrowserDistribution* dist, HKEY root, // StartMenuInternet\Chromium so for old users we still need to delete // the old key. std::wstring old_set_access_key(ShellUtil::kRegStartMenuInternet); - file_util::AppendToPath(&old_set_access_key, installer_util::kChromeExe); + file_util::AppendToPath(&old_set_access_key, installer::kChromeExe); InstallUtil::DeleteRegistryKey(key, old_set_access_key); // Delete Software\RegisteredApplications\Chromium @@ -428,12 +428,12 @@ bool DeleteChromeRegistrationKeys(BrowserDistribution* dist, HKEY root, // Delete Software\Classes\Applications\chrome.exe std::wstring app_key(ShellUtil::kRegClasses); file_util::AppendToPath(&app_key, L"Applications"); - file_util::AppendToPath(&app_key, installer_util::kChromeExe); + file_util::AppendToPath(&app_key, installer::kChromeExe); InstallUtil::DeleteRegistryKey(key, app_key); // Delete the App Paths key that lets explorer find Chrome. std::wstring app_path_key(ShellUtil::kAppPathsRegistryKey); - file_util::AppendToPath(&app_path_key, installer_util::kChromeExe); + file_util::AppendToPath(&app_path_key, installer::kChromeExe); InstallUtil::DeleteRegistryKey(key, app_path_key); // Cleanup OpenWithList @@ -441,12 +441,12 @@ bool DeleteChromeRegistrationKeys(BrowserDistribution* dist, HKEY root, std::wstring open_with_key(ShellUtil::kRegClasses); file_util::AppendToPath(&open_with_key, ShellUtil::kFileAssociations[i]); file_util::AppendToPath(&open_with_key, L"OpenWithList"); - file_util::AppendToPath(&open_with_key, installer_util::kChromeExe); + file_util::AppendToPath(&open_with_key, installer::kChromeExe); InstallUtil::DeleteRegistryKey(key, open_with_key); } key.Close(); - exit_code = installer_util::UNINSTALL_SUCCESSFUL; + exit_code = installer::UNINSTALL_SUCCESSFUL; return true; } @@ -489,7 +489,7 @@ InstallStatus UninstallChrome(const FilePath& setup_path, bool remove_all, bool force_uninstall, const CommandLine& cmd_line) { - InstallStatus status = installer_util::UNINSTALL_CONFIRMED; + InstallStatus status = installer::UNINSTALL_CONFIRMED; std::wstring suffix; if (!ShellUtil::GetUserSpecificDefaultBrowserSuffix(product.distribution(), &suffix)) @@ -510,8 +510,8 @@ InstallStatus UninstallChrome(const FilePath& setup_path, } else if (is_chrome) { // no --force-uninstall so lets show some UI dialog boxes. status = IsChromeActiveOrUserCancelled(product); - if (status != installer_util::UNINSTALL_CONFIRMED && - status != installer_util::UNINSTALL_DELETE_PROFILE) + if (status != installer::UNINSTALL_CONFIRMED && + status != installer::UNINSTALL_DELETE_PROFILE) return status; // Check if we need admin rights to cleanup HKLM. If we do, try to launch @@ -521,19 +521,19 @@ InstallStatus UninstallChrome(const FilePath& setup_path, (!suffix.empty() || CurrentUserHasDefaultBrowser(product)) && !::IsUserAnAdmin() && base::win::GetVersion() >= base::win::VERSION_VISTA && - !cmd_line.HasSwitch(installer_util::switches::kRunAsAdmin)) { + !cmd_line.HasSwitch(installer::switches::kRunAsAdmin)) { CommandLine new_cmd(CommandLine::NO_PROGRAM); new_cmd.AppendArguments(cmd_line, true); // Append --run-as-admin flag to let the new instance of setup.exe know // that we already tried to launch ourselves as admin. - new_cmd.AppendSwitch(installer_util::switches::kRunAsAdmin); + new_cmd.AppendSwitch(installer::switches::kRunAsAdmin); // Append --remove-chrome-registration to remove registry keys only. - new_cmd.AppendSwitch(installer_util::switches::kRemoveChromeRegistration); + new_cmd.AppendSwitch(installer::switches::kRemoveChromeRegistration); if (!suffix.empty()) { new_cmd.AppendSwitchNative( - installer_util::switches::kRegisterChromeBrowserSuffix, suffix); + installer::switches::kRegisterChromeBrowserSuffix, suffix); } - DWORD exit_code = installer_util::UNKNOWN_STATUS; + DWORD exit_code = installer::UNKNOWN_STATUS; InstallUtil::ExecuteExeAsAdmin(new_cmd, &exit_code); } } @@ -570,7 +570,7 @@ InstallStatus UninstallChrome(const FilePath& setup_path, product.SetMsiMarker(false); // Remove all Chrome registration keys. - InstallStatus ret = installer_util::UNKNOWN_STATUS; + InstallStatus ret = installer::UNKNOWN_STATUS; DeleteChromeRegistrationKeys(product.distribution(), reg_root, suffix, ret); // For user level install also we end up creating some keys in HKLM if user @@ -590,7 +590,7 @@ InstallStatus UninstallChrome(const FilePath& setup_path, // as we never set the key for those products. RegKey hklm_key(HKEY_LOCAL_MACHINE, L"", KEY_ALL_ACCESS); std::wstring reg_path(installer::kMediaPlayerRegPath); - file_util::AppendToPath(®_path, installer_util::kChromeExe); + file_util::AppendToPath(®_path, installer::kChromeExe); InstallUtil::DeleteRegistryKey(hklm_key, reg_path); hklm_key.Close(); } @@ -614,12 +614,12 @@ InstallStatus UninstallChrome(const FilePath& setup_path, } if (!installed_version.get()) - return installer_util::UNINSTALL_SUCCESSFUL; + return installer::UNINSTALL_SUCCESSFUL; // Finally delete all the files from Chrome folder after moving setup.exe // and the user's Local State to a temp location. bool delete_profile = ShouldDeleteProfile(cmd_line, status, product); - ret = installer_util::UNINSTALL_SUCCESSFUL; + ret = installer::UNINSTALL_SUCCESSFUL; // In order to be able to remove the folder in which we're running, we // need to move setup.exe out of the install folder. @@ -639,9 +639,9 @@ InstallStatus UninstallChrome(const FilePath& setup_path, DeleteLocalState(product); if (delete_result == DELETE_FAILED) { - ret = installer_util::UNINSTALL_FAILED; + ret = installer::UNINSTALL_FAILED; } else if (delete_result == DELETE_REQUIRES_REBOOT) { - ret = installer_util::UNINSTALL_REQUIRES_REBOOT; + ret = installer::UNINSTALL_REQUIRES_REBOOT; } if (!force_uninstall) { diff --git a/chrome/installer/setup/uninstall.h b/chrome/installer/setup/uninstall.h index 9165091..9d265cb 100644 --- a/chrome/installer/setup/uninstall.h +++ b/chrome/installer/setup/uninstall.h @@ -24,7 +24,7 @@ namespace installer { // suffix for default browser entry name in the registry (optional). bool DeleteChromeRegistrationKeys(BrowserDistribution* dist, HKEY root, const std::wstring& browser_entry_suffix, - installer_util::InstallStatus& exit_code); + installer::InstallStatus& exit_code); // Removes any legacy registry keys from earlier versions of Chrome that are no // longer needed. This is used during autoupdate since we don't do full @@ -41,7 +41,7 @@ void RemoveLegacyRegistryKeys(BrowserDistribution* dist); // any checks for Chrome running. // cmd_line: CommandLine that contains information about the command that // was used to launch current uninstaller. -installer_util::InstallStatus UninstallChrome( +installer::InstallStatus UninstallChrome( const FilePath& setup_path, const Product& dist, bool remove_all, bool force_uninstall, const CommandLine& cmd_line); 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<class DistributionClass> 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<FilePath> BrowserDistribution::GetKeyFiles() { std::vector<FilePath> 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<FilePath> 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<class DistributionClass> 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<FilePath> ChromeFrameDistribution::GetKeyFiles() { std::vector<FilePath> 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<FilePath> ChromeFrameDistribution::GetComDllList() { std::vector<FilePath> 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<FilePath> 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<FilePath> 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<GoogleChromeDistribution*>( 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 <string> -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<std::wstring>* candidates) { } // namespace -namespace installer_util { +namespace installer { LanguageSelector::LanguageSelector() : offset_(arraysize(kLanguageOffsetPairs)) { @@ -298,4 +298,4 @@ void LanguageSelector::DoSelect(const std::vector<std::wstring>& 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<std::wstring>(&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<std::wstring>(&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<std::wstring>(&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<std::wstring>(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<GURL> 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<Version> 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<WorkItemList> 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<Product> { // 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_ diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc index 0d18716..7cafd20 100644 --- a/chrome/test/mini_installer_test/chrome_mini_installer.cc +++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc @@ -210,9 +210,9 @@ void ChromeMiniInstaller::Repair( MiniInstallerTestUtil::CloseProcesses( mini_installer_constants::kIEProcessName); } else { - MiniInstallerTestUtil::CloseProcesses(installer_util::kNaClExe); + MiniInstallerTestUtil::CloseProcesses(installer::kNaClExe); } - MiniInstallerTestUtil::CloseProcesses(installer_util::kChromeExe); + MiniInstallerTestUtil::CloseProcesses(installer::kChromeExe); if (repair_type == ChromeMiniInstaller::VERSION_FOLDER) { DeleteFolder(L"version_folder"); printf("Deleted folder. Now trying to launch chrome\n"); @@ -253,9 +253,9 @@ void ChromeMiniInstaller::UnInstall() { MiniInstallerTestUtil::CloseProcesses( mini_installer_constants::kIEProcessName); } else { - MiniInstallerTestUtil::CloseProcesses(installer_util::kNaClExe); + MiniInstallerTestUtil::CloseProcesses(installer::kNaClExe); } - MiniInstallerTestUtil::CloseProcesses(installer_util::kChromeExe); + MiniInstallerTestUtil::CloseProcesses(installer::kChromeExe); std::wstring uninstall_path = GetUninstallPath(); if (uninstall_path == L"") { printf("\n %ls install is in a weird state. Cleaning the machine...\n", @@ -330,7 +330,7 @@ bool ChromeMiniInstaller::CloseChromeBrowser() { HWND handle = NULL; // This loop iterates through all of the top-level Windows // named Chrome_WidgetWin_0 and closes them - while ((base::GetProcessCount(installer_util::kChromeExe, NULL) > 0) && + while ((base::GetProcessCount(installer::kChromeExe, NULL) > 0) && (timer < 40000)) { // Chrome may have been launched, but the window may not have appeared // yet. Wait for it to appear for 10 seconds, but exit if it takes longer @@ -351,11 +351,11 @@ bool ChromeMiniInstaller::CloseChromeBrowser() { PlatformThread::Sleep(1000); timer = timer + 1000; } - if (base::GetProcessCount(installer_util::kChromeExe, NULL) > 0) { + if (base::GetProcessCount(installer::kChromeExe, NULL) > 0) { printf("Chrome.exe is still running even after closing all windows\n"); return false; } - if (base::GetProcessCount(installer_util::kNaClExe, NULL) > 0) { + if (base::GetProcessCount(installer::kNaClExe, NULL) > 0) { printf("NaCl.exe is still running even after closing all windows\n"); return false; } @@ -506,7 +506,7 @@ std::wstring ChromeMiniInstaller::GetUninstallPath() { file_util::AppendToPath(&path, mini_installer_constants::kChromeAppDir); } file_util::AppendToPath(&path, reg_key_value); - file_util::AppendToPath(&path, installer_util::kInstallerDir); + file_util::AppendToPath(&path, installer::kInstallerDir); file_util::AppendToPath(&path, mini_installer_constants::kChromeSetupExecutable); if (!file_util::PathExists(FilePath(path))) { @@ -568,7 +568,7 @@ bool ChromeMiniInstaller::GetChromeLaunchPath(std::wstring* launch_path) { std::wstring path; path = GetChromeInstallDirectoryLocation(); file_util::AppendToPath(&path, mini_installer_constants::kChromeAppDir); - file_util::AppendToPath(&path, installer_util::kChromeExe); + file_util::AppendToPath(&path, installer::kChromeExe); launch_path->assign(path); return file_util::PathExists(FilePath(path)); } @@ -579,16 +579,16 @@ void ChromeMiniInstaller::LaunchAndCloseChrome(bool over_install) { if ((install_type_ == mini_installer_constants::kSystemInstall) && (!over_install)) { MiniInstallerTestUtil::VerifyProcessLaunch( - installer_util::kChromeExe, true); + installer::kChromeExe, true); } - MiniInstallerTestUtil::CloseProcesses(installer_util::kChromeExe); + MiniInstallerTestUtil::CloseProcesses(installer::kChromeExe); } // This method will get Chrome exe path and launch it. void ChromeMiniInstaller::VerifyChromeLaunch(bool expected_status) { std::wstring launch_path; GetChromeLaunchPath(&launch_path); - LaunchBrowser(launch_path, L"", installer_util::kChromeExe, expected_status); + LaunchBrowser(launch_path, L"", installer::kChromeExe, expected_status); } // Verifies Chrome/Chrome Frame install. @@ -599,7 +599,7 @@ void ChromeMiniInstaller::VerifyInstall(bool over_install) { if ((install_type_ == mini_installer_constants::kUserInstall) && (!over_install)) { MiniInstallerTestUtil::VerifyProcessLaunch( - installer_util::kChromeExe, true); + installer::kChromeExe, true); } PlatformThread::Sleep(800); FindChromeShortcut(); @@ -623,7 +623,7 @@ void ChromeMiniInstaller::VerifyChromeFrameInstall() { base::LaunchApp(cmd_line, false, false, NULL); // Check if Chrome process got spawned. - MiniInstallerTestUtil::VerifyProcessLaunch(installer_util::kChromeExe, true); + MiniInstallerTestUtil::VerifyProcessLaunch(installer::kChromeExe, true); // Verify if IExplore folder got created FilePath path = GetUserDataDirPath(); diff --git a/chrome/test/mini_installer_test/run_all_unittests.cc b/chrome/test/mini_installer_test/run_all_unittests.cc index 26a3afc..4ba1ea3 100644 --- a/chrome/test/mini_installer_test/run_all_unittests.cc +++ b/chrome/test/mini_installer_test/run_all_unittests.cc @@ -52,7 +52,7 @@ int main(int argc, char** argv) { "from all levels before proceeding with tests.\n"); } else if (command_line.HasSwitch(switches::kInstallerTestBackup)) { BackUpProfile(command_line.HasSwitch( - installer_util::switches::kChromeFrame)); + installer::switches::kChromeFrame)); } else { printf("This test needs command line arguments.\n"); printf("Usage: %ls -{clean|backup} [-build <version>] [-force] \n", diff --git a/chrome/test/mini_installer_test/test.cc b/chrome/test/mini_installer_test/test.cc index 8b70211..d4e31ee 100644 --- a/chrome/test/mini_installer_test/test.cc +++ b/chrome/test/mini_installer_test/test.cc @@ -27,16 +27,16 @@ class MiniInstallTest : public testing::Test { static void CleanTheSystem() { const CommandLine* cmd = CommandLine::ForCurrentProcess(); - if (cmd->HasSwitch(installer_util::switches::kChromeFrame)) { + if (cmd->HasSwitch(installer::switches::kChromeFrame)) { ChromeMiniInstaller systeminstall(kSystemInstall, - cmd->HasSwitch(installer_util::switches::kChromeFrame)); + cmd->HasSwitch(installer::switches::kChromeFrame)); systeminstall.UnInstall(); } else { ChromeMiniInstaller userinstall(kUserInstall, - cmd->HasSwitch(installer_util::switches::kChromeFrame)); + cmd->HasSwitch(installer::switches::kChromeFrame)); userinstall.UnInstall(); ChromeMiniInstaller systeminstall(kSystemInstall, - cmd->HasSwitch(installer_util::switches::kChromeFrame)); + cmd->HasSwitch(installer::switches::kChromeFrame)); systeminstall.UnInstall(); } } @@ -48,7 +48,7 @@ class MiniInstallTest : public testing::Test { cmd->GetSwitchValueNative(switches::kInstallerTestBuild); if (build.empty()) build = L"latest"; - chrome_frame_ = cmd->HasSwitch(installer_util::switches::kChromeFrame); + chrome_frame_ = cmd->HasSwitch(installer::switches::kChromeFrame); CleanTheSystem(); // Separate the test output from cleaning output |