| Index: chrome/installer/setup/install.cc
|
| ===================================================================
|
| --- chrome/installer/setup/install.cc (revision 69167)
|
| +++ chrome/installer/setup/install.cc (working copy)
|
| @@ -44,7 +44,7 @@
|
| 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 @@
|
| 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 @@
|
| 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 @@
|
| 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 @@
|
| 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 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 @@
|
| // 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 @@
|
| 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 @@
|
| 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 @@
|
| .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 @@
|
| // 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 @@
|
| // 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 @@
|
| // 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 @@
|
|
|
| // 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 @@
|
| 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 @@
|
|
|
| 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 @@
|
| 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 @@
|
| 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 @@
|
| }
|
|
|
| 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 @@
|
| // 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);
|
| }
|
|
|
|
|