summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-23 18:53:52 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-23 18:53:52 +0000
commitd5937dff5bfa06d68262fc6d569cd5f5a6ac57c4 (patch)
tree1e5eb583fb086699df3db28c776b88f655625784 /chrome/installer
parent3a29e2911047223baf873271abacf5ae34502fc6 (diff)
downloadchromium_src-d5937dff5bfa06d68262fc6d569cd5f5a6ac57c4.zip
chromium_src-d5937dff5bfa06d68262fc6d569cd5f5a6ac57c4.tar.gz
chromium_src-d5937dff5bfa06d68262fc6d569cd5f5a6ac57c4.tar.bz2
Revert "installer: clean up to use FilePath instead of std::wstring."
This reverts commit 9da05365beb211e3879e6049547e5e92c4c0a5a2 (r32811). TBR=thiago.farina@gmail.com BUG=32811 Review URL: http://codereview.chromium.org/437011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32817 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/setup/install.cc226
-rw-r--r--chrome/installer/setup/install.h15
-rw-r--r--chrome/installer/setup/setup_main.cc93
-rw-r--r--chrome/installer/setup/uninstall.cc65
-rw-r--r--chrome/installer/setup/uninstall.h12
-rw-r--r--chrome/installer/util/browser_distribution.cc2
-rw-r--r--chrome/installer/util/browser_distribution.h3
-rw-r--r--chrome/installer/util/copy_tree_work_item.cc8
-rw-r--r--chrome/installer/util/copy_tree_work_item.h8
-rw-r--r--chrome/installer/util/copy_tree_work_item_unittest.cc80
-rw-r--r--chrome/installer/util/delete_tree_work_item.cc4
-rw-r--r--chrome/installer/util/delete_tree_work_item.h4
-rw-r--r--chrome/installer/util/delete_tree_work_item_unittest.cc9
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc18
-rw-r--r--chrome/installer/util/google_chrome_distribution.h12
-rw-r--r--chrome/installer/util/helper.cc45
-rw-r--r--chrome/installer/util/helper.h8
-rw-r--r--chrome/installer/util/helper_unittest.cc4
-rw-r--r--chrome/installer/util/logging_installer.cc6
-rw-r--r--chrome/installer/util/move_tree_work_item.cc6
-rw-r--r--chrome/installer/util/move_tree_work_item.h6
-rw-r--r--chrome/installer/util/move_tree_work_item_unittest.cc22
-rw-r--r--chrome/installer/util/work_item.cc16
-rw-r--r--chrome/installer/util/work_item.h16
-rw-r--r--chrome/installer/util/work_item_list.cc18
-rw-r--r--chrome/installer/util/work_item_list.h18
26 files changed, 376 insertions, 348 deletions
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index 12273f9..143f5ba 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -37,6 +37,13 @@ COMPILE_ASSERT(kNumDllsToRegister > 0,
namespace {
+std::wstring AppendPath(const std::wstring& parent_path,
+ const std::wstring& path) {
+ std::wstring new_path(parent_path);
+ file_util::AppendToPath(&new_path, path);
+ return new_path;
+}
+
void AddChromeToMediaPlayerList() {
std::wstring reg_path(installer::kMediaPlayerRegPath);
// registry paths can also be appended like file system path
@@ -50,19 +57,24 @@ void AddChromeToMediaPlayerList() {
LOG(ERROR) << "Could not add Chrome to media player inclusion list.";
}
-void AddInstallerCopyTasks(const FilePath& exe_path,
- const FilePath& archive_path,
- const FilePath& temp_path,
- const FilePath& install_path,
+void AddInstallerCopyTasks(const std::wstring& exe_path,
+ const std::wstring& archive_path,
+ const std::wstring& temp_path,
+ const std::wstring& install_path,
const std::wstring& new_version,
WorkItemList* install_list,
bool system_level) {
- FilePath installer_dir(installer::GetInstallerPathUnderChrome(install_path,
- new_version));
- install_list->AddCreateDirWorkItem(installer_dir);
-
- FilePath exe_dst(installer_dir.Append(exe_path.BaseName()));
- FilePath archive_dst(installer_dir.Append(archive_path.BaseName()));
+ std::wstring installer_dir(installer::GetInstallerPathUnderChrome(
+ install_path, new_version));
+ install_list->AddCreateDirWorkItem(
+ FilePath::FromWStringHack(installer_dir));
+
+ std::wstring exe_dst(installer_dir);
+ std::wstring archive_dst(installer_dir);
+ file_util::AppendToPath(&exe_dst,
+ file_util::GetFilenameFromPath(exe_path));
+ file_util::AppendToPath(&archive_dst,
+ file_util::GetFilenameFromPath(archive_path));
install_list->AddCopyTreeWorkItem(exe_path, exe_dst, temp_path,
WorkItem::ALWAYS);
@@ -105,15 +117,16 @@ void AppendUninstallCommandLineFlags(std::wstring* uninstall_cmd_line,
// This method adds work items to create (or update) Chrome uninstall entry in
// Control Panel->Add/Remove Programs list.
void AddUninstallShortcutWorkItems(HKEY reg_root,
- const FilePath& exe_path,
- const FilePath& install_path,
+ const std::wstring& exe_path,
+ const std::wstring& install_path,
const std::wstring& product_name,
const std::wstring& new_version,
WorkItemList* install_list) {
std::wstring uninstall_cmd(L"\"");
uninstall_cmd.append(installer::GetInstallerPathUnderChrome(install_path,
- new_version).value());
- file_util::AppendToPath(&uninstall_cmd, exe_path.BaseName().value());
+ new_version));
+ file_util::AppendToPath(&uninstall_cmd,
+ file_util::GetFilenameFromPath(exe_path));
uninstall_cmd.append(L"\"");
AppendUninstallCommandLineFlags(&uninstall_cmd,
@@ -131,12 +144,11 @@ void AddUninstallShortcutWorkItems(HKEY reg_root,
uninstall_cmd, true);
install_list->AddSetRegValueWorkItem(reg_root,
uninstall_reg,
- L"InstallLocation",
- install_path.value(), true);
+ L"InstallLocation", install_path, true);
// DisplayIcon, NoModify and NoRepair
- std::wstring chrome_icon = install_path.Append(
- installer_util::kChromeExe).value();
+ std::wstring chrome_icon = AppendPath(install_path,
+ installer_util::kChromeExe);
ShellUtil::GetChromeIcon(chrome_icon);
install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
L"DisplayIcon", chrome_icon, true);
@@ -168,11 +180,14 @@ void AddUninstallShortcutWorkItems(HKEY reg_root,
// as chrome.exe so Chrome first run can find it. This function will be called
// only on the first install of Chrome.
void CopyPreferenceFileForFirstRun(bool system_level,
- const FilePath& prefs_source_path) {
- FilePath prefs_dest_path = installer::GetChromeInstallPath(system_level);
+ const std::wstring& prefs_source_path) {
+ FilePath prefs_dest_path = FilePath::FromWStringHack(
+ installer::GetChromeInstallPath(system_level));
prefs_dest_path = prefs_dest_path.Append(installer_util::kDefaultMasterPrefs);
- if (!file_util::CopyFile(prefs_source_path, prefs_dest_path))
+ if (!file_util::CopyFile(FilePath::FromWStringHack(prefs_source_path),
+ prefs_dest_path)) {
LOG(INFO) << "Failed to copy master preferences.";
+ }
}
// This method creates Chrome shortcuts in Start->Programs for all users or
@@ -189,8 +204,8 @@ void CopyPreferenceFileForFirstRun(bool system_level,
//
// If the shortcuts do not exist, the function does not recreate them during
// update.
-bool CreateOrUpdateChromeShortcuts(const FilePath& exe_path,
- const FilePath& install_path,
+bool CreateOrUpdateChromeShortcuts(const std::wstring& exe_path,
+ const std::wstring& install_path,
const std::wstring& new_version,
installer_util::InstallStatus install_status,
bool system_install,
@@ -218,52 +233,53 @@ bool CreateOrUpdateChromeShortcuts(const FilePath& exe_path,
// shortcuts since our install. So on updates we only update if shortcut
// already exists)
bool ret = true;
- // Chrome link (launches Chrome).
- FilePath chrome_link(shortcut_path.Append(product_name + L".lnk"));
- // Chrome link target.
- FilePath chrome_exe(install_path.Append(installer_util::kChromeExe));
+ FilePath chrome_link(shortcut_path); // Chrome link (launches Chrome)
+ chrome_link = chrome_link.Append(product_name + L".lnk");
+ std::wstring chrome_exe(install_path); // Chrome link target
+ file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe);
if ((install_status == installer_util::FIRST_INSTALL_SUCCESS) ||
(install_status == installer_util::INSTALL_REPAIRED)) {
if (!file_util::PathExists(shortcut_path))
- file_util::CreateDirectory(shortcut_path);
+ file_util::CreateDirectoryW(shortcut_path);
- LOG(INFO) << "Creating shortcut to " << chrome_exe.value() << " at "
+ LOG(INFO) << "Creating shortcut to " << chrome_exe << " at "
<< chrome_link.value();
- ret = ret && ShellUtil::UpdateChromeShortcut(chrome_exe.value(),
+ ret = ret && ShellUtil::UpdateChromeShortcut(chrome_exe,
chrome_link.value(),
product_desc, true);
} else if (file_util::PathExists(chrome_link)) {
LOG(INFO) << "Updating shortcut at " << chrome_link.value()
- << " to point to " << chrome_exe.value();
- ret = ret && ShellUtil::UpdateChromeShortcut(chrome_exe.value(),
+ << " to point to " << chrome_exe;
+ ret = ret && ShellUtil::UpdateChromeShortcut(chrome_exe,
chrome_link.value(),
product_desc, false);
}
- // Create/update uninstall link.
- FilePath uninstall_link(shortcut_path.Append(
- dist->GetUninstallLinkName() + L".lnk"));
+ // Create/update uninstall link
+ FilePath uninstall_link(shortcut_path); // Uninstall Chrome link
+ uninstall_link = uninstall_link.Append(
+ dist->GetUninstallLinkName() + L".lnk");
if ((install_status == installer_util::FIRST_INSTALL_SUCCESS) ||
(install_status == installer_util::INSTALL_REPAIRED) ||
(file_util::PathExists(uninstall_link))) {
if (!file_util::PathExists(shortcut_path))
- file_util::CreateDirectory(shortcut_path);
- FilePath setup_exe(installer::GetInstallerPathUnderChrome(install_path,
- new_version));
- setup_exe = setup_exe.Append(exe_path.BaseName());
+ file_util::CreateDirectoryW(shortcut_path);
+ std::wstring setup_exe(installer::GetInstallerPathUnderChrome(install_path,
+ new_version));
+ file_util::AppendToPath(&setup_exe,
+ file_util::GetFilenameFromPath(exe_path));
std::wstring arguments;
AppendUninstallCommandLineFlags(&arguments, system_install);
LOG(INFO) << "Creating/updating uninstall link at "
<< uninstall_link.value();
- ret = ret && file_util::CreateShortcutLink(setup_exe.value().c_str(),
+ ret = ret && file_util::CreateShortcutLink(setup_exe.c_str(),
uninstall_link.value().c_str(),
NULL,
arguments.c_str(),
- NULL, setup_exe.value().c_str(),
- 0,
+ NULL, setup_exe.c_str(), 0,
NULL);
}
@@ -271,16 +287,16 @@ bool CreateOrUpdateChromeShortcuts(const FilePath& exe_path,
// is specified we want to create them, otherwise we update them only if
// they exist.
if (system_install) {
- ret = ret && ShellUtil::CreateChromeDesktopShortcut(chrome_exe.value(),
+ ret = ret && ShellUtil::CreateChromeDesktopShortcut(chrome_exe,
product_desc, ShellUtil::SYSTEM_LEVEL, alt_shortcut,
create_all_shortcut);
- ret = ret && ShellUtil::CreateChromeQuickLaunchShortcut(chrome_exe.value(),
+ ret = ret && ShellUtil::CreateChromeQuickLaunchShortcut(chrome_exe,
ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL, create_all_shortcut);
} else {
- ret = ret && ShellUtil::CreateChromeDesktopShortcut(chrome_exe.value(),
+ ret = ret && ShellUtil::CreateChromeDesktopShortcut(chrome_exe,
product_desc, ShellUtil::CURRENT_USER, alt_shortcut,
create_all_shortcut);
- ret = ret && ShellUtil::CreateChromeQuickLaunchShortcut(chrome_exe.value(),
+ ret = ret && ShellUtil::CreateChromeQuickLaunchShortcut(chrome_exe,
ShellUtil::CURRENT_USER, create_all_shortcut);
}
@@ -295,8 +311,8 @@ bool CreateOrUpdateChromeShortcuts(const FilePath& exe_path,
// If these operations are successful, the function returns true, otherwise
// false.
bool DoPostInstallTasks(HKEY reg_root,
- const FilePath& exe_path,
- const FilePath& install_path,
+ const std::wstring& exe_path,
+ const std::wstring& install_path,
const std::wstring& new_chrome_exe,
const std::wstring& current_version,
const installer::Version& new_version) {
@@ -318,13 +334,12 @@ bool DoPostInstallTasks(HKEY reg_root,
current_version.c_str(),
true);
- FilePath setup_exe_path(installer::GetInstallerPathUnderChrome(install_path,
- new_version.GetString()));
- setup_exe_path = setup_exe_path.Append(exe_path.BaseName());
-
- std::wstring rename_cmd = L"\"" + setup_exe_path.value() +
- L"\" --" + installer_util::switches::kRenameChromeExe;
-
+ std::wstring rename_cmd(installer::GetInstallerPathUnderChrome(
+ install_path, new_version.GetString()));
+ file_util::AppendToPath(&rename_cmd,
+ file_util::GetFilenameFromPath(exe_path));
+ rename_cmd = L"\"" + rename_cmd +
+ L"\" --" + installer_util::switches::kRenameChromeExe;
if (reg_root == HKEY_LOCAL_MACHINE)
rename_cmd = rename_cmd + L" --" + installer_util::switches::kSystemLevel;
@@ -362,12 +377,11 @@ bool DoPostInstallTasks(HKEY reg_root,
// Now we need to register any self registering components and unregister
// any that were left from the old version that is being upgraded:
if (!current_version.empty()) {
- FilePath old_dll_path(install_path.Append(current_version));
+ std::wstring old_dll_path(install_path);
+ file_util::AppendToPath(&old_dll_path, current_version);
scoped_ptr<WorkItemList> old_dll_list(WorkItem::CreateWorkItemList());
- if (InstallUtil::BuildDLLRegistrationList(old_dll_path.value(),
- kDllsToRegister,
- kNumDllsToRegister,
- false,
+ if (InstallUtil::BuildDLLRegistrationList(old_dll_path, kDllsToRegister,
+ kNumDllsToRegister, false,
old_dll_list.get())) {
// Don't abort the install as a result of a failure to unregister old
// DLLs.
@@ -375,9 +389,10 @@ bool DoPostInstallTasks(HKEY reg_root,
}
}
- FilePath dll_path(install_path.Append(new_version.GetString()));
+ std::wstring dll_path(install_path);
+ file_util::AppendToPath(&dll_path, new_version.GetString());
scoped_ptr<WorkItemList> dll_list(WorkItem::CreateWorkItemList());
- if (InstallUtil::BuildDLLRegistrationList(dll_path.value(), kDllsToRegister,
+ if (InstallUtil::BuildDLLRegistrationList(dll_path, kDllsToRegister,
kNumDllsToRegister, true,
dll_list.get())) {
if (!dll_list->Do()) {
@@ -407,7 +422,7 @@ bool Is64bit() {
return false;
}
-void RegisterChromeOnMachine(const FilePath& install_path,
+void RegisterChromeOnMachine(const std::wstring& install_path,
bool system_level,
bool make_chrome_default) {
// Try to add Chrome to Media Player shim inclusion list. We don't do any
@@ -417,15 +432,16 @@ void RegisterChromeOnMachine(const FilePath& install_path,
// 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(install_path.Append(installer_util::kChromeExe));
+ std::wstring chrome_exe(install_path);
+ file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe);
LOG(INFO) << "Registering Chrome as browser";
if (make_chrome_default) {
int level = ShellUtil::CURRENT_USER;
if (system_level)
level = level | ShellUtil::SYSTEM_LEVEL;
- ShellUtil::MakeChromeDefault(level, chrome_exe.value(), true);
+ ShellUtil::MakeChromeDefault(level, chrome_exe, true);
} else {
- ShellUtil::RegisterChromeBrowser(chrome_exe.value(), L"", false);
+ ShellUtil::RegisterChromeBrowser(chrome_exe, L"", false);
}
}
@@ -454,11 +470,11 @@ void RegisterChromeOnMachine(const FilePath& install_path,
// install_path. If install_path does not exist before calling the function
// (typical new install), the function creates install_path during install
// and removes the whole directory during rollback.
-bool InstallNewVersion(const FilePath& exe_path,
- const FilePath& archive_path,
- const FilePath& src_path,
- const FilePath& install_path,
- const FilePath& temp_dir,
+bool InstallNewVersion(const std::wstring& exe_path,
+ const std::wstring& archive_path,
+ const std::wstring& src_path,
+ const std::wstring& install_path,
+ const std::wstring& temp_dir,
const HKEY reg_root,
const installer::Version& new_version,
std::wstring* current_version) {
@@ -467,59 +483,60 @@ bool InstallNewVersion(const FilePath& exe_path,
if (InstallUtil::IsChromeFrameProcess()) {
// Make sure that we don't end up deleting installed files on next reboot.
- if (!RemoveFromMovesPendingReboot(install_path.value().c_str())) {
+ if (!RemoveFromMovesPendingReboot(install_path.c_str())) {
LOG(ERROR) << "Error accessing pending moves value.";
}
}
scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList());
// A temp directory that work items need and the actual install directory.
- install_list->AddCreateDirWorkItem(temp_dir);
- install_list->AddCreateDirWorkItem(install_path);
+ install_list->AddCreateDirWorkItem(FilePath::FromWStringHack(temp_dir));
+ install_list->AddCreateDirWorkItem(FilePath::FromWStringHack(install_path));
// If it is system level install copy the version folder (since we want to
// take the permissions of %ProgramFiles% folder) otherwise just move it.
if (reg_root == HKEY_LOCAL_MACHINE) {
install_list->AddCopyTreeWorkItem(
- src_path.Append(new_version.GetString()),
- install_path.Append(new_version.GetString()),
+ AppendPath(src_path, new_version.GetString()),
+ AppendPath(install_path, new_version.GetString()),
temp_dir, WorkItem::ALWAYS);
} else {
install_list->AddMoveTreeWorkItem(
- src_path.Append(new_version.GetString()),
- install_path.Append(new_version.GetString()),
+ AppendPath(src_path, new_version.GetString()),
+ AppendPath(install_path, new_version.GetString()),
temp_dir);
}
// 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(install_path.Append(installer_util::kChromeNewExe));
+ std::wstring new_chrome_exe = AppendPath(install_path,
+ installer_util::kChromeNewExe);
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
RegKey chrome_key(reg_root, dist->GetVersionKey().c_str(), KEY_READ);
- if (file_util::PathExists(new_chrome_exe))
+ if (file_util::PathExists(FilePath::FromWStringHack(new_chrome_exe)))
chrome_key.ReadValue(google_update::kRegOldVersionField, current_version);
if (current_version->empty())
chrome_key.ReadValue(google_update::kRegVersionField, current_version);
chrome_key.Close();
- install_list->AddDeleteTreeWorkItem(new_chrome_exe, FilePath());
+ install_list->AddDeleteTreeWorkItem(new_chrome_exe, std::wstring());
install_list->AddCopyTreeWorkItem(
- src_path.Append(installer_util::kChromeExe),
- install_path.Append(installer_util::kChromeExe),
+ AppendPath(src_path, installer_util::kChromeExe),
+ AppendPath(install_path, installer_util::kChromeExe),
temp_dir, WorkItem::NEW_NAME_IF_IN_USE, new_chrome_exe);
// Extra executable for 64 bit systems.
if (Is64bit()) {
install_list->AddCopyTreeWorkItem(
- src_path.Append(installer::kWowHelperExe),
- install_path.Append(installer::kWowHelperExe),
+ AppendPath(src_path, installer::kWowHelperExe),
+ AppendPath(install_path, installer::kWowHelperExe),
temp_dir, WorkItem::ALWAYS);
}
// Copy the default Dictionaries only if the folder doesnt exist already
install_list->AddCopyTreeWorkItem(
- src_path.Append(installer::kDictionaries),
- install_path.Append(installer::kDictionaries),
+ AppendPath(src_path, installer::kDictionaries),
+ AppendPath(install_path, installer::kDictionaries),
temp_dir, WorkItem::IF_NOT_PRESENT);
// Copy installer in install directory and
@@ -533,7 +550,7 @@ bool InstallNewVersion(const FilePath& exe_path,
// Delete any old_chrome.exe if present.
install_list->AddDeleteTreeWorkItem(
- install_path.Append(installer_util::kChromeOldExe), FilePath());
+ AppendPath(install_path, installer_util::kChromeOldExe), std::wstring());
// Create Version key (if not already present) and set the new Chrome
// version as last step.
@@ -550,8 +567,7 @@ bool InstallNewVersion(const FilePath& exe_path,
if (!install_list->Do() ||
!DoPostInstallTasks(reg_root, exe_path, install_path,
- new_chrome_exe.value(),
- *current_version, new_version)) {
+ new_chrome_exe, *current_version, new_version)) {
LOG(ERROR) << "Install failed, rolling back... ";
install_list->Rollback();
LOG(ERROR) << "Rollback complete. ";
@@ -563,35 +579,33 @@ bool InstallNewVersion(const FilePath& exe_path,
} // namespace
-FilePath installer::GetInstallerPathUnderChrome(const FilePath& install_path,
- const std::wstring& new_version)
-{
- FilePath installer_path(install_path.Append(new_version));
- installer_path = installer_path.Append(installer_util::kInstallerDir);
+std::wstring installer::GetInstallerPathUnderChrome(
+ const std::wstring& install_path, const std::wstring& new_version) {
+ std::wstring installer_path(install_path);
+ file_util::AppendToPath(&installer_path, new_version);
+ file_util::AppendToPath(&installer_path, installer_util::kInstallerDir);
return installer_path;
}
installer_util::InstallStatus installer::InstallOrUpdateChrome(
- const FilePath& exe_path,
- const FilePath& archive_path,
- const FilePath& install_temp_path,
- const FilePath& prefs_path,
- const DictionaryValue* prefs,
- const Version& new_version,
+ const std::wstring& exe_path, const std::wstring& archive_path,
+ const std::wstring& install_temp_path, const std::wstring& prefs_path,
+ const DictionaryValue* prefs, const Version& new_version,
const Version* installed_version) {
bool system_install = false;
installer_util::GetDistroBooleanPreference(prefs,
installer_util::master_preferences::kSystemLevel, &system_install);
- FilePath install_path(GetChromeInstallPath(system_install));
+ std::wstring install_path(GetChromeInstallPath(system_install));
if (install_path.empty()) {
LOG(ERROR) << "Could not get installation destination path.";
return installer_util::INSTALL_FAILED;
} else {
- LOG(INFO) << "install destination path: " << install_path.value();
+ LOG(INFO) << "install destination path: " << install_path;
}
- FilePath src_path(install_temp_path.Append(kInstallSourceDir));
- src_path = src_path.Append(kInstallSourceChromeDir);
+ std::wstring src_path(install_temp_path);
+ file_util::AppendToPath(&src_path, std::wstring(kInstallSourceDir));
+ file_util::AppendToPath(&src_path, std::wstring(kInstallSourceChromeDir));
HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
std::wstring current_version;
@@ -606,7 +620,7 @@ installer_util::InstallStatus installer::InstallOrUpdateChrome(
if (!installed_version) {
LOG(INFO) << "First install of version " << new_version.GetString();
result = installer_util::FIRST_INSTALL_SUCCESS;
- CopyPreferenceFileForFirstRun(system_install, FilePath(prefs_path));
+ CopyPreferenceFileForFirstRun(system_install, prefs_path);
} else if (new_version.GetString() == installed_version->GetString()) {
LOG(INFO) << "Install repaired of version " << new_version.GetString();
result = installer_util::INSTALL_REPAIRED;
diff --git a/chrome/installer/setup/install.h b/chrome/installer/setup/install.h
index 8810803..305819a 100644
--- a/chrome/installer/setup/install.h
+++ b/chrome/installer/setup/install.h
@@ -12,13 +12,11 @@
#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/version.h"
-class FilePath;
-
namespace installer {
// Get path to the installer under Chrome version folder
// (for example <path>\Google\Chrome\<Version>\installer)
-FilePath GetInstallerPathUnderChrome(const FilePath& install_path,
- const std::wstring& new_version);
+std::wstring GetInstallerPathUnderChrome(const std::wstring& install_path,
+ const std::wstring& new_version);
// This function installs or updates a new version of Chrome. It returns
// install status (failed, new_install, updated etc).
@@ -38,12 +36,9 @@ FilePath GetInstallerPathUnderChrome(const FilePath& install_path,
// Note: since caller unpacks Chrome to install_temp_path\source, the caller
// is responsible for cleaning up install_temp_path.
installer_util::InstallStatus InstallOrUpdateChrome(
- const FilePath& exe_path,
- const FilePath& archive_path,
- const FilePath& install_temp_path,
- const FilePath& prefs_path,
- const DictionaryValue* prefs,
- const Version& new_version,
+ const std::wstring& exe_path, const std::wstring& archive_path,
+ const std::wstring& install_temp_path, const std::wstring& prefs_path,
+ const DictionaryValue* prefs, const Version& new_version,
const Version* installed_version);
}
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 5cfae0d..dab45e2 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -51,23 +51,23 @@ namespace {
// is unpacked in the path specified by parameter "path".
DWORD UnPackArchive(const std::wstring& archive, bool system_install,
const installer::Version* installed_version,
- const FilePath& temp_path, const FilePath& path,
+ const std::wstring& temp_path, const std::wstring& path,
bool& incremental_install) {
// First uncompress the payload. This could be a differential
// update (patch.7z) or full archive (chrome.7z). If this uncompress fails
// return with error.
std::wstring unpacked_file;
- int32 ret = LzmaUtil::UnPackArchive(archive, temp_path.value(),
- &unpacked_file);
+ int32 ret = LzmaUtil::UnPackArchive(archive, temp_path, &unpacked_file);
if (ret != NO_ERROR)
return ret;
- FilePath uncompressed_archive(temp_path.Append(installer::kChromeArchive));
+ std::wstring uncompressed_archive(temp_path);
+ file_util::AppendToPath(&uncompressed_archive, installer::kChromeArchive);
// 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
// it is a differential installer if chrome.7z is not found.
- if (!file_util::PathExists(uncompressed_archive)) {
+ if (!file_util::PathExists(FilePath::FromWStringHack(uncompressed_archive))) {
incremental_install = true;
LOG(INFO) << "Differential patch found. Applying to existing archive.";
if (!installed_version) {
@@ -75,20 +75,21 @@ DWORD UnPackArchive(const std::wstring& archive, bool system_install,
<< "installed on the system.";
return installer_util::CHROME_NOT_INSTALLED;
}
- FilePath existing_archive(installer::GetChromeInstallPath(system_install));
- existing_archive = existing_archive.Append(installed_version->GetString());
- existing_archive = existing_archive.Append(installer_util::kInstallerDir);
- existing_archive = existing_archive.Append(installer::kChromeArchive);
- if (int i = setup_util::ApplyDiffPatch(existing_archive.value(),
- unpacked_file, uncompressed_archive.value())) {
+ std::wstring existing_archive =
+ installer::GetChromeInstallPath(system_install);
+ file_util::AppendToPath(&existing_archive,
+ installed_version->GetString());
+ file_util::AppendToPath(&existing_archive, installer_util::kInstallerDir);
+ file_util::AppendToPath(&existing_archive, installer::kChromeArchive);
+ if (int i = setup_util::ApplyDiffPatch(existing_archive, unpacked_file,
+ uncompressed_archive)) {
LOG(ERROR) << "Binary patching failed with error " << i;
return i;
}
}
// Unpack the uncompressed archive.
- return LzmaUtil::UnPackArchive(uncompressed_archive.value(), path.value(),
- &unpacked_file);
+ return LzmaUtil::UnPackArchive(uncompressed_archive, path, &unpacked_file);
}
@@ -98,14 +99,17 @@ DWORD UnPackArchive(const std::wstring& archive, bool system_install,
// 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(bool system_install) {
- FilePath chrome_path(installer::GetChromeInstallPath(system_install));
+ std::wstring chrome_path(installer::GetChromeInstallPath(system_install));
- FilePath chrome_exe(chrome_path.Append(installer_util::kChromeExe));
- FilePath chrome_old_exe(chrome_path.Append(installer_util::kChromeOldExe));
- FilePath chrome_new_exe(chrome_path.Append(installer_util::kChromeNewExe));
+ std::wstring chrome_exe(chrome_path);
+ file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe);
+ std::wstring chrome_old_exe(chrome_path);
+ file_util::AppendToPath(&chrome_old_exe, installer_util::kChromeOldExe);
+ std::wstring chrome_new_exe(chrome_path);
+ file_util::AppendToPath(&chrome_new_exe, installer_util::kChromeNewExe);
scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList());
- install_list->AddDeleteTreeWorkItem(chrome_old_exe, FilePath());
+ install_list->AddDeleteTreeWorkItem(chrome_old_exe, std::wstring());
FilePath temp_path;
if (!file_util::CreateNewTempDirectory(L"chrome_", &temp_path)) {
LOG(ERROR) << "Failed to create Temp directory " << temp_path.value();
@@ -113,16 +117,16 @@ installer_util::InstallStatus RenameChromeExecutables(bool system_install) {
}
install_list->AddCopyTreeWorkItem(chrome_new_exe,
chrome_exe,
- temp_path,
+ temp_path.ToWStringHack(),
WorkItem::IF_DIFFERENT,
- FilePath());
+ std::wstring());
HKEY reg_root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
BrowserDistribution *dist = BrowserDistribution::GetDistribution();
install_list->AddDeleteRegValueWorkItem(reg_root,
dist->GetVersionKey(),
google_update::kRegOldVersionField,
true);
- install_list->AddDeleteTreeWorkItem(chrome_new_exe, FilePath());
+ install_list->AddDeleteTreeWorkItem(chrome_new_exe, std::wstring());
install_list->AddDeleteRegValueWorkItem(reg_root,
dist->GetVersionKey(),
google_update::kRegRenameCmdField,
@@ -158,7 +162,8 @@ bool CheckPreInstallConditions(const installer::Version* installed_version,
// either does not exist or can be deleted (i.e. is not locked by some other
// process).
if (!installed_version) {
- FilePath install_path(installer::GetChromeInstallPath(system_install));
+ FilePath install_path = FilePath::FromWStringHack(
+ installer::GetChromeInstallPath(system_install));
if (file_util::PathExists(install_path) &&
!file_util::Delete(install_path, true)) {
LOG(ERROR) << "Installation directory " << install_path.value()
@@ -209,19 +214,24 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
LOG(INFO) << "created path " << temp_path.value();
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- FilePath unpack_path(temp_path.Append(installer::kInstallSourceDir));
+ std::wstring unpack_path(temp_path.ToWStringHack());
+ file_util::AppendToPath(&unpack_path,
+ std::wstring(installer::kInstallSourceDir));
bool incremental_install = false;
if (UnPackArchive(archive, system_level, installed_version,
- temp_path, unpack_path, incremental_install)) {
+ temp_path.ToWStringHack(), unpack_path,
+ incremental_install)) {
install_status = installer_util::UNCOMPRESSION_FAILED;
InstallUtil::WriteInstallerResult(system_level, install_status,
IDS_INSTALL_UNCOMPRESSION_FAILED_BASE,
NULL);
} else {
- LOG(INFO) << "unpacked to " << unpack_path.value();
- FilePath src_path(unpack_path.Append(installer::kInstallSourceChromeDir));
+ LOG(INFO) << "unpacked to " << unpack_path;
+ std::wstring src_path(unpack_path);
+ file_util::AppendToPath(&src_path,
+ std::wstring(installer::kInstallSourceChromeDir));
scoped_ptr<installer::Version>
- installer_version(setup_util::GetVersionFromDir(src_path.value()));
+ installer_version(setup_util::GetVersionFromDir(src_path));
if (!installer_version.get()) {
LOG(ERROR) << "Did not find any valid version in installer.";
install_status = installer_util::INVALID_ARCHIVE;
@@ -239,17 +249,19 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
} else {
// We want to keep uncompressed archive (chrome.7z) that we get after
// 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.GetSwitchValuePath(
- WideToASCII(installer_util::switches::kInstallerData));
+ std::wstring archive_to_copy(temp_path.ToWStringHack());
+ file_util::AppendToPath(&archive_to_copy,
+ std::wstring(installer::kChromeArchive));
+ std::wstring prefs_source_path = cmd_line.GetSwitchValue(
+ installer_util::switches::kInstallerData);
install_status = installer::InstallOrUpdateChrome(
- cmd_line.GetProgram(), archive_to_copy, temp_path,
+ cmd_line.program(), archive_to_copy, temp_path.ToWStringHack(),
prefs_source_path, prefs, *installer_version, installed_version);
int install_msg_base = IDS_INSTALL_FAILED_BASE;
std::wstring chrome_exe;
if (install_status != installer_util::INSTALL_FAILED) {
- chrome_exe = installer::GetChromeInstallPath(system_level).value();
+ chrome_exe = installer::GetChromeInstallPath(system_level);
if (chrome_exe.empty()) {
// If we failed to construct install path, it means the OS call to
// get %ProgramFiles% or %AppData% failed. Report this as failure.
@@ -297,11 +309,12 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
// and master profile file if present.
scoped_ptr<WorkItemList> cleanup_list(WorkItem::CreateWorkItemList());
LOG(INFO) << "Deleting temporary directory " << temp_path.value();
- cleanup_list->AddDeleteTreeWorkItem(temp_path, FilePath());
+ cleanup_list->AddDeleteTreeWorkItem(temp_path.ToWStringHack(),
+ std::wstring());
if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) {
- FilePath prefs_path = cmd_line.GetSwitchValuePath(
- WideToASCII(installer_util::switches::kInstallerData));
- cleanup_list->AddDeleteTreeWorkItem(prefs_path, FilePath());
+ std::wstring prefs_path = cmd_line.GetSwitchValue(
+ installer_util::switches::kInstallerData);
+ cleanup_list->AddDeleteTreeWorkItem(prefs_path, std::wstring());
}
cleanup_list->Do();
@@ -327,9 +340,9 @@ installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line,
bool remove_all = !cmd_line.HasSwitch(
installer_util::switches::kDoNotRemoveSharedItems);
- return installer_setup::UninstallChrome(cmd_line.GetProgram(), system_install,
- remove_all, force, cmd_line,
- cmd_params);
+ return installer_setup::UninstallChrome(cmd_line.program(), system_install,
+ remove_all, force,
+ cmd_line, cmd_params);
}
installer_util::InstallStatus ShowEULADialog(const std::wstring& inner_frame) {
@@ -381,7 +394,7 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
installer_util::switches::kUpdateSetupExe);
LOG(INFO) << "Opening archive " << setup_patch;
std::wstring uncompressed_patch;
- if (LzmaUtil::UnPackArchive(setup_patch, temp_path.value(),
+ if (LzmaUtil::UnPackArchive(setup_patch, temp_path.ToWStringHack(),
&uncompressed_patch) == NO_ERROR) {
std::wstring old_setup_exe = cmd_line.program();
std::wstring new_setup_exe = cmd_line.GetSwitchValue(
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index 2ffef62..16c07c1 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -70,11 +70,12 @@ bool CurrentUserHasDefaultBrowser(bool system_uninstall) {
RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str());
std::wstring reg_exe;
if (key.ReadValue(L"", &reg_exe) && reg_exe.length() > 2) {
- FilePath chrome_exe(installer::GetChromeInstallPath(system_uninstall));
- chrome_exe = chrome_exe.Append(installer_util::kChromeExe);
+ std::wstring chrome_exe = installer::GetChromeInstallPath(system_uninstall);
+ file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe);
reg_exe = reg_exe.substr(1, reg_exe.length() - 2);
- FilePath reg_path(reg_exe);
- if (chrome_exe == reg_path)
+ if ((reg_exe.size() == chrome_exe.size()) &&
+ (std::equal(chrome_exe.begin(), chrome_exe.end(),
+ reg_exe.begin(), CaseInsensitiveCompare<wchar_t>())))
return true;
}
@@ -168,29 +169,27 @@ enum DeleteResult {
// Returns DELETE_FAILED if it could not get the path to the install dir.
// Returns DELETE_REQUIRES_REBOOT if the files were in use and so were
// scheduled for deletion on next reboot.
-DeleteResult DeleteFilesAndFolders(const FilePath& exe_path,
- bool system_uninstall,
- const installer::Version& installed_version,
- FilePath* local_state_path,
- bool delete_profile) {
- FilePath install_path(installer::GetChromeInstallPath(system_uninstall));
+DeleteResult DeleteFilesAndFolders(const std::wstring& exe_path,
+ bool system_uninstall, const installer::Version& installed_version,
+ std::wstring* local_state_path, bool delete_profile) {
+ std::wstring install_path(installer::GetChromeInstallPath(system_uninstall));
if (install_path.empty()) {
LOG(ERROR) << "Could not get installation destination path.";
return DELETE_FAILED; // Nothing else we can do to uninstall, so we return.
} else {
- LOG(INFO) << "install destination path: " << install_path.value();
+ LOG(INFO) << "install destination path: " << install_path;
}
// Move setup.exe to the temp path.
- FilePath setup_exe(installer::GetInstallerPathUnderChrome(
+ std::wstring setup_exe(installer::GetInstallerPathUnderChrome(
install_path, installed_version.GetString()));
- setup_exe = setup_exe.Append(exe_path.BaseName());
+ file_util::AppendToPath(&setup_exe, file_util::GetFilenameFromPath(exe_path));
FilePath temp_file;
if (!file_util::CreateTemporaryFile(&temp_file)) {
LOG(ERROR) << "Failed to create temporary file for setup.exe.";
} else {
- FilePath setup_exe_path(setup_exe);
+ FilePath setup_exe_path = FilePath::FromWStringHack(setup_exe);
file_util::Move(setup_exe_path, temp_file);
}
@@ -209,7 +208,7 @@ DeleteResult DeleteFilesAndFolders(const FilePath& exe_path,
if (got_local_state) {
FilePath user_local_file(
user_local_state.Append(chrome::kLocalStateFilename));
- FilePath path = *local_state_path;
+ FilePath path = FilePath::FromWStringHack(*local_state_path);
if (!file_util::CreateTemporaryFile(&path))
LOG(ERROR) << "Failed to create temporary file for Local State.";
else
@@ -220,21 +219,20 @@ DeleteResult DeleteFilesAndFolders(const FilePath& exe_path,
DeleteResult result = DELETE_SUCCEEDED;
- LOG(INFO) << "Deleting install path " << install_path.value();
+ LOG(INFO) << "Deleting install path " << install_path;
if (!file_util::Delete(install_path, true)) {
- LOG(ERROR) << "Failed to delete folder (1st try): " << install_path.value();
+ LOG(ERROR) << "Failed to delete folder (1st try): " << install_path;
if (InstallUtil::IsChromeFrameProcess()) {
// We don't try killing Chrome processes for Chrome Frame builds since
// that is unlikely to help. Instead, schedule files for deletion and
// return a value that will trigger a reboot prompt.
- ScheduleDirectoryForDeletion(install_path.value().c_str());
+ ScheduleDirectoryForDeletion(install_path.c_str());
result = DELETE_REQUIRES_REBOOT;
} else {
// Try closing any running chrome processes and deleting files once again.
CloseAllChromeProcesses();
if (!file_util::Delete(install_path, true)) {
- LOG(ERROR) << "Failed to delete folder (2nd try): " <<
- install_path.value();
+ LOG(ERROR) << "Failed to delete folder (2nd try): " << install_path;
result = DELETE_FAILED;
}
}
@@ -267,7 +265,7 @@ DeleteResult DeleteFilesAndFolders(const FilePath& exe_path,
} else {
// Now check and delete if the parent directories are empty
// For example Google\Chrome or Chromium
- DeleteEmptyParentDir(install_path.value());
+ DeleteEmptyParentDir(install_path);
}
return result;
}
@@ -427,12 +425,9 @@ const wchar_t kChromeExtProgId[] = L"ChromiumExt";
}
installer_util::InstallStatus installer_setup::UninstallChrome(
- const FilePath& exe_path,
- bool system_uninstall,
- bool remove_all,
- bool force_uninstall,
- const CommandLine& cmd_line,
- const wchar_t* cmd_params) {
+ const std::wstring& exe_path, bool system_uninstall,
+ bool remove_all, bool force_uninstall,
+ const CommandLine& cmd_line, const wchar_t* cmd_params) {
installer_util::InstallStatus status = installer_util::UNINSTALL_CONFIRMED;
std::wstring suffix;
if (!ShellUtil::GetUserSpecificDefaultBrowserSuffix(&suffix))
@@ -522,14 +517,12 @@ installer_util::InstallStatus installer_setup::UninstallChrome(
if (installed_version.get()) {
// Unregister any dll servers that we may have registered.
- FilePath dll_path(installer::GetChromeInstallPath(system_uninstall));
- dll_path = dll_path.Append(installed_version->GetString());
+ std::wstring dll_path(installer::GetChromeInstallPath(system_uninstall));
+ file_util::AppendToPath(&dll_path, installed_version->GetString());
scoped_ptr<WorkItemList> dll_list(WorkItem::CreateWorkItemList());
- if (InstallUtil::BuildDLLRegistrationList(dll_path.value(),
- kDllsToRegister,
- kNumDllsToRegister,
- false,
+ if (InstallUtil::BuildDLLRegistrationList(dll_path, kDllsToRegister,
+ kNumDllsToRegister, false,
dll_list.get())) {
dll_list->Do();
}
@@ -543,11 +536,11 @@ installer_util::InstallStatus installer_setup::UninstallChrome(
// and the user's Local State to a temp location.
bool delete_profile = (status == installer_util::UNINSTALL_DELETE_PROFILE) ||
(cmd_line.HasSwitch(installer_util::switches::kDeleteProfile));
- FilePath local_state_path;
+ std::wstring local_state_path;
ret = installer_util::UNINSTALL_SUCCESSFUL;
- DeleteResult delete_result = DeleteFilesAndFolders(exe_path, system_uninstall,
- *installed_version, &local_state_path, delete_profile);
+ DeleteResult delete_result = DeleteFilesAndFolders(exe_path,
+ system_uninstall, *installed_version, &local_state_path, delete_profile);
if (delete_result == DELETE_FAILED) {
ret = installer_util::UNINSTALL_FAILED;
} else if (delete_result == DELETE_REQUIRES_REBOOT) {
diff --git a/chrome/installer/setup/uninstall.h b/chrome/installer/setup/uninstall.h
index a0be3d6..a2320ad 100644
--- a/chrome/installer/setup/uninstall.h
+++ b/chrome/installer/setup/uninstall.h
@@ -15,8 +15,6 @@
#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/version.h"
-class FilePath;
-
namespace installer_setup {
// This function removes all Chrome registration related keys. It returns true
// if successful, otherwise false. The error code is set in |exit_code|.
@@ -44,12 +42,10 @@ void RemoveLegacyRegistryKeys();
// cmd_line: CommandLine that contains information about the command that
// was used to launch current uninstaller.
// cmd_params: Command line parameters passed to the uninstaller.
-installer_util::InstallStatus UninstallChrome(const FilePath& exe_path,
- bool system_uninstall,
- bool remove_all,
- bool force_uninstall,
- const CommandLine& cmd_line,
- const wchar_t* cmd_params);
+installer_util::InstallStatus UninstallChrome(
+ const std::wstring& exe_path, bool system_uninstall,
+ bool remove_all, bool force_uninstall,
+ const CommandLine& cmd_line, const wchar_t* cmd_params);
} // namespace installer_setup
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc
index e5f1af9..fe9884f 100644
--- a/chrome/installer/util/browser_distribution.cc
+++ b/chrome/installer/util/browser_distribution.cc
@@ -40,7 +40,7 @@ BrowserDistribution* BrowserDistribution::GetDistribution(bool chrome_frame) {
}
void BrowserDistribution::DoPostUninstallOperations(
- const installer::Version& version, const FilePath& local_data_path,
+ const installer::Version& version, const std::wstring& local_data_path,
const std::wstring& distribution_data) {
}
diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h
index 2ffb74c..8948bdc 100644
--- a/chrome/installer/util/browser_distribution.h
+++ b/chrome/installer/util/browser_distribution.h
@@ -11,7 +11,6 @@
#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/version.h"
-class FilePath;
class RegKey;
class BrowserDistribution {
@@ -21,7 +20,7 @@ class BrowserDistribution {
static BrowserDistribution* GetDistribution();
virtual void DoPostUninstallOperations(const installer::Version& version,
- const FilePath& local_data_path,
+ const std::wstring& local_data_path,
const std::wstring& distribution_data);
virtual std::wstring GetAppGuid();
diff --git a/chrome/installer/util/copy_tree_work_item.cc b/chrome/installer/util/copy_tree_work_item.cc
index d161ed9..22007990 100644
--- a/chrome/installer/util/copy_tree_work_item.cc
+++ b/chrome/installer/util/copy_tree_work_item.cc
@@ -14,11 +14,11 @@ CopyTreeWorkItem::~CopyTreeWorkItem() {
}
}
-CopyTreeWorkItem::CopyTreeWorkItem(const FilePath& source_path,
- const FilePath& dest_path,
- const FilePath& temp_dir,
+CopyTreeWorkItem::CopyTreeWorkItem(const std::wstring& source_path,
+ const std::wstring& dest_path,
+ const std::wstring& temp_dir,
CopyOverWriteOption overwrite_option,
- const FilePath& alternative_path)
+ const std::wstring& alternative_path)
: source_path_(source_path),
dest_path_(dest_path),
temp_dir_(temp_dir),
diff --git a/chrome/installer/util/copy_tree_work_item.h b/chrome/installer/util/copy_tree_work_item.h
index c1478922..b899324 100644
--- a/chrome/installer/util/copy_tree_work_item.h
+++ b/chrome/installer/util/copy_tree_work_item.h
@@ -35,11 +35,11 @@ class CopyTreeWorkItem : public WorkItem {
// Notes on temp_path: to facilitate rollback, the caller needs to supply
// a temporary directory to save the original files if they exist under
// dest_path.
- CopyTreeWorkItem(const FilePath& source_path,
- const FilePath& dest_path,
- const FilePath& temp_dir,
+ CopyTreeWorkItem(const std::wstring& source_path,
+ const std::wstring& dest_path,
+ const std::wstring& temp_dir,
CopyOverWriteOption overwrite_option,
- const FilePath& alternative_path);
+ const std::wstring& alternative_path);
// Checks if the path specified is in use (and hence can not be deleted)
bool IsFileInUse(const FilePath& path);
diff --git a/chrome/installer/util/copy_tree_work_item_unittest.cc b/chrome/installer/util/copy_tree_work_item_unittest.cc
index a9aa986..bc187e61 100644
--- a/chrome/installer/util/copy_tree_work_item_unittest.cc
+++ b/chrome/installer/util/copy_tree_work_item_unittest.cc
@@ -108,9 +108,9 @@ TEST_F(CopyTreeWorkItemTest, CopyFile) {
// test Do()
scoped_ptr<CopyTreeWorkItem> work_item(
- WorkItem::CreateCopyTreeWorkItem(file_name_from,
- file_name_to,
- temp_dir_,
+ WorkItem::CreateCopyTreeWorkItem(file_name_from.ToWStringHack(),
+ file_name_to.ToWStringHack(),
+ temp_dir_.ToWStringHack(),
WorkItem::ALWAYS));
EXPECT_TRUE(work_item->Do());
@@ -149,9 +149,9 @@ TEST_F(CopyTreeWorkItemTest, CopyFileOverwrite) {
// test Do() with always_overwrite being true.
scoped_ptr<CopyTreeWorkItem> work_item(
- WorkItem::CreateCopyTreeWorkItem(file_name_from,
- file_name_to,
- temp_dir_,
+ WorkItem::CreateCopyTreeWorkItem(file_name_from.ToWStringHack(),
+ file_name_to.ToWStringHack(),
+ temp_dir_.ToWStringHack(),
WorkItem::ALWAYS));
EXPECT_TRUE(work_item->Do());
@@ -172,9 +172,9 @@ TEST_F(CopyTreeWorkItemTest, CopyFileOverwrite) {
// test Do() with always_overwrite being false.
// the file is still overwritten since the content is different.
work_item.reset(
- WorkItem::CreateCopyTreeWorkItem(file_name_from,
- file_name_to,
- temp_dir_,
+ WorkItem::CreateCopyTreeWorkItem(file_name_from.ToWStringHack(),
+ file_name_to.ToWStringHack(),
+ temp_dir_.ToWStringHack(),
WorkItem::IF_DIFFERENT));
EXPECT_TRUE(work_item->Do());
@@ -221,9 +221,9 @@ TEST_F(CopyTreeWorkItemTest, CopyFileSameContent) {
// test Do() with always_overwrite being true.
scoped_ptr<CopyTreeWorkItem> work_item(
- WorkItem::CreateCopyTreeWorkItem(file_name_from,
- file_name_to,
- temp_dir_,
+ WorkItem::CreateCopyTreeWorkItem(file_name_from.ToWStringHack(),
+ file_name_to.ToWStringHack(),
+ temp_dir_.ToWStringHack(),
WorkItem::ALWAYS));
EXPECT_TRUE(work_item->Do());
@@ -249,9 +249,9 @@ TEST_F(CopyTreeWorkItemTest, CopyFileSameContent) {
// test Do() with always_overwrite being false. nothing should change.
work_item.reset(
- WorkItem::CreateCopyTreeWorkItem(file_name_from,
- file_name_to,
- temp_dir_,
+ WorkItem::CreateCopyTreeWorkItem(file_name_from.ToWStringHack(),
+ file_name_to.ToWStringHack(),
+ temp_dir_.ToWStringHack(),
WorkItem::IF_DIFFERENT));
EXPECT_TRUE(work_item->Do());
@@ -300,9 +300,9 @@ TEST_F(CopyTreeWorkItemTest, CopyFileAndCleanup) {
{
// test Do().
scoped_ptr<CopyTreeWorkItem> work_item(
- WorkItem::CreateCopyTreeWorkItem(file_name_from,
- file_name_to,
- temp_dir_,
+ WorkItem::CreateCopyTreeWorkItem(file_name_from.ToWStringHack(),
+ file_name_to.ToWStringHack(),
+ temp_dir_.ToWStringHack(),
WorkItem::IF_DIFFERENT));
EXPECT_TRUE(work_item->Do());
@@ -362,8 +362,10 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUse) {
// test Do().
scoped_ptr<CopyTreeWorkItem> work_item(
- WorkItem::CreateCopyTreeWorkItem(file_name_from, file_name_to, temp_dir_,
- WorkItem::IF_DIFFERENT));
+ WorkItem::CreateCopyTreeWorkItem(file_name_from.ToWStringHack(),
+ file_name_to.ToWStringHack(),
+ temp_dir_.ToWStringHack(),
+ WorkItem::IF_DIFFERENT));
EXPECT_TRUE(work_item->Do());
@@ -438,8 +440,11 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) {
// test Do().
scoped_ptr<CopyTreeWorkItem> work_item(
- WorkItem::CreateCopyTreeWorkItem(file_name_from, file_name_to, temp_dir_,
- WorkItem::NEW_NAME_IF_IN_USE, alternate_to));
+ WorkItem::CreateCopyTreeWorkItem(file_name_from.ToWStringHack(),
+ file_name_to.ToWStringHack(),
+ temp_dir_.ToWStringHack(),
+ WorkItem::NEW_NAME_IF_IN_USE,
+ alternate_to.ToWStringHack()));
EXPECT_TRUE(work_item->Do());
@@ -469,11 +474,10 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) {
CloseHandle(pi.hThread);
// Now the process has terminated, lets try overwriting the file again
- work_item.reset(WorkItem::CreateCopyTreeWorkItem(file_name_from,
- file_name_to,
- temp_dir_,
- WorkItem::NEW_NAME_IF_IN_USE,
- alternate_to));
+ work_item.reset(WorkItem::CreateCopyTreeWorkItem(
+ file_name_from.ToWStringHack(), file_name_to.ToWStringHack(),
+ temp_dir_.ToWStringHack(), WorkItem::NEW_NAME_IF_IN_USE,
+ alternate_to.ToWStringHack()));
if (IsFileInUse(file_name_to))
PlatformThread::Sleep(2000);
// If file is still in use, the rest of the test will fail.
@@ -532,8 +536,9 @@ TEST_F(CopyTreeWorkItemTest, IfNotPresentTest) {
// test Do().
scoped_ptr<CopyTreeWorkItem> work_item(
- WorkItem::CreateCopyTreeWorkItem(file_name_from, file_name_to, temp_dir_,
- WorkItem::IF_NOT_PRESENT, FilePath()));
+ WorkItem::CreateCopyTreeWorkItem(file_name_from.ToWStringHack(),
+ file_name_to.ToWStringHack(), temp_dir_.ToWStringHack(),
+ WorkItem::IF_NOT_PRESENT, L""));
EXPECT_TRUE(work_item->Do());
// verify that the source, destination have not changed and backup path
@@ -557,8 +562,9 @@ TEST_F(CopyTreeWorkItemTest, IfNotPresentTest) {
// Now delete the destination and try copying the file again.
file_util::Delete(file_name_to, true);
- work_item.reset(WorkItem::CreateCopyTreeWorkItem(file_name_from, file_name_to,
- temp_dir_, WorkItem::IF_NOT_PRESENT, FilePath()));
+ work_item.reset(WorkItem::CreateCopyTreeWorkItem(
+ file_name_from.ToWStringHack(), file_name_to.ToWStringHack(),
+ temp_dir_.ToWStringHack(), WorkItem::IF_NOT_PRESENT, L""));
EXPECT_TRUE(work_item->Do());
// verify that the source, destination are the same and backup path
@@ -621,8 +627,10 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUseAndCleanup) {
// test Do().
{
scoped_ptr<CopyTreeWorkItem> work_item(
- WorkItem::CreateCopyTreeWorkItem(file_name_from, file_name_to,
- temp_dir_, WorkItem::IF_DIFFERENT));
+ WorkItem::CreateCopyTreeWorkItem(file_name_from.ToWStringHack(),
+ file_name_to.ToWStringHack(),
+ temp_dir_.ToWStringHack(),
+ WorkItem::IF_DIFFERENT));
EXPECT_TRUE(work_item->Do());
@@ -680,8 +688,10 @@ TEST_F(CopyTreeWorkItemTest, CopyTree) {
// test Do()
{
scoped_ptr<CopyTreeWorkItem> work_item(
- WorkItem::CreateCopyTreeWorkItem(dir_name_from, dir_name_to, temp_dir_,
- WorkItem::ALWAYS));
+ WorkItem::CreateCopyTreeWorkItem(dir_name_from.ToWStringHack(),
+ dir_name_to.ToWStringHack(),
+ temp_dir_.ToWStringHack(),
+ WorkItem::ALWAYS));
EXPECT_TRUE(work_item->Do());
}
diff --git a/chrome/installer/util/delete_tree_work_item.cc b/chrome/installer/util/delete_tree_work_item.cc
index 531f10a..839f6bb 100644
--- a/chrome/installer/util/delete_tree_work_item.cc
+++ b/chrome/installer/util/delete_tree_work_item.cc
@@ -21,8 +21,8 @@ DeleteTreeWorkItem::~DeleteTreeWorkItem() {
}
}
-DeleteTreeWorkItem::DeleteTreeWorkItem(const FilePath& root_path,
- const FilePath& key_path)
+DeleteTreeWorkItem::DeleteTreeWorkItem(const std::wstring& root_path,
+ const std::wstring& key_path)
: root_path_(root_path),
key_path_(key_path) {
}
diff --git a/chrome/installer/util/delete_tree_work_item.h b/chrome/installer/util/delete_tree_work_item.h
index ff347dd..b5bcb50 100644
--- a/chrome/installer/util/delete_tree_work_item.h
+++ b/chrome/installer/util/delete_tree_work_item.h
@@ -30,8 +30,8 @@ class DeleteTreeWorkItem : public WorkItem {
// Get a backup path that can keep root_path_ or key_path_
bool GetBackupPath(const FilePath& for_path, FilePath* backup_path);
- DeleteTreeWorkItem(const FilePath& root_path,
- const FilePath& key_path);
+ DeleteTreeWorkItem(const std::wstring& root_path,
+ const std::wstring& key_path);
// Root path to delete.
FilePath root_path_;
diff --git a/chrome/installer/util/delete_tree_work_item_unittest.cc b/chrome/installer/util/delete_tree_work_item_unittest.cc
index acd66cc..02c2bb0 100644
--- a/chrome/installer/util/delete_tree_work_item_unittest.cc
+++ b/chrome/installer/util/delete_tree_work_item_unittest.cc
@@ -87,7 +87,8 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeNoKeyPath) {
// test Do()
scoped_ptr<DeleteTreeWorkItem> work_item(
- WorkItem::CreateDeleteTreeWorkItem(dir_name_delete, FilePath()));
+ WorkItem::CreateDeleteTreeWorkItem(dir_name_delete.ToWStringHack(),
+ std::wstring()));
EXPECT_TRUE(work_item->Do());
// everything should be gone
@@ -134,7 +135,8 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTree) {
// test Do()
scoped_ptr<DeleteTreeWorkItem> work_item(
- WorkItem::CreateDeleteTreeWorkItem(dir_name_delete, file_name_delete_1));
+ WorkItem::CreateDeleteTreeWorkItem(dir_name_delete.ToWStringHack(),
+ file_name_delete_1.ToWStringHack()));
EXPECT_TRUE(work_item->Do());
// everything should be gone
@@ -202,7 +204,8 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeInUse) {
// test Do().
{
scoped_ptr<DeleteTreeWorkItem> work_item(
- WorkItem::CreateDeleteTreeWorkItem(dir_name_delete, key_path));
+ WorkItem::CreateDeleteTreeWorkItem(dir_name_delete.ToWStringHack(),
+ key_path.ToWStringHack()));
// delete should fail as file in use.
EXPECT_FALSE(work_item->Do());
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index b3a09c4..faf574b 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -68,11 +68,11 @@ int FileTimeToHours(const FILETIME& time) {
// Returns the directory last write time in hours since January 1, 1601.
// Returns -1 if there was an error retrieving the directory time.
-int GetDirectoryWriteTimeInHours(const FilePath& path) {
+int GetDirectoryWriteTimeInHours(const wchar_t* path) {
// To open a directory you need to pass FILE_FLAG_BACKUP_SEMANTICS.
DWORD share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
- HANDLE file = ::CreateFileW(path.value().c_str(), 0, share, NULL,
- OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+ HANDLE file = ::CreateFileW(path, 0, share, NULL, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (INVALID_HANDLE_VALUE == file)
return -1;
FILETIME time;
@@ -84,7 +84,7 @@ int GetDirectoryWriteTimeInHours(const FilePath& path) {
// Returns the directory last-write time age in hours, relative to current
// time, so if it returns 14 it means that the directory was last written 14
// hours ago. Returns -1 if there was an error retrieving the directory.
-int GetDirectoryWriteAgeInHours(const FilePath& path) {
+int GetDirectoryWriteAgeInHours(const wchar_t* path) {
int dir_time = GetDirectoryWriteTimeInHours(path);
if (dir_time < 0)
return dir_time;
@@ -128,9 +128,9 @@ bool GoogleChromeDistribution::BuildUninstallMetricsString(
}
bool GoogleChromeDistribution::ExtractUninstallMetricsFromFile(
- const FilePath& file_path, std::wstring* uninstall_metrics_string) {
+ const std::wstring& file_path, std::wstring* uninstall_metrics_string) {
- JSONFileValueSerializer json_serializer(file_path);
+ JSONFileValueSerializer json_serializer(FilePath::FromWStringHack(file_path));
std::string json_error_string;
scoped_ptr<Value> root(json_serializer.Deserialize(NULL));
@@ -172,7 +172,7 @@ bool GoogleChromeDistribution::ExtractUninstallMetrics(
}
void GoogleChromeDistribution::DoPostUninstallOperations(
- const installer::Version& version, const FilePath& local_data_path,
+ const installer::Version& version, const std::wstring& local_data_path,
const std::wstring& distribution_data) {
// Send the Chrome version and OS version as params to the form.
// It would be nice to send the locale, too, but I don't see an
@@ -447,9 +447,9 @@ void GoogleChromeDistribution::LaunchUserExperiment(
LOG(INFO) << "User in experiment locale";
// Check browser usage inactivity by the age of the last-write time of the
// chrome user data directory. Ninety days is our trigger.
- FilePath user_data_dir(installer::GetChromeUserDataPath());
+ std::wstring user_data_dir = installer::GetChromeUserDataPath();
const int kSixtyDays = 60 * 24;
- int dir_age_hours = GetDirectoryWriteAgeInHours(user_data_dir);
+ int dir_age_hours = GetDirectoryWriteAgeInHours(user_data_dir.c_str());
if (dir_age_hours < kSixtyDays)
return;
// At this point the user qualifies for the experiment, however we need to
diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h
index 2e88858..c696e61 100644
--- a/chrome/installer/util/google_chrome_distribution.h
+++ b/chrome/installer/util/google_chrome_distribution.h
@@ -14,7 +14,6 @@
#include "testing/gtest/include/gtest/gtest_prod.h" // for FRIEND_TEST
class DictionaryValue;
-class FilePath;
class GoogleChromeDistribution : public BrowserDistribution {
public:
@@ -28,7 +27,7 @@ class GoogleChromeDistribution : public BrowserDistribution {
// concatenated to the survey url if the file in local_data_path indicates
// the user has opted in to providing anonymous usage data.
virtual void DoPostUninstallOperations(const installer::Version& version,
- const FilePath& local_data_path,
+ const std::wstring& local_data_path,
const std::wstring& distribution_data);
virtual std::wstring GetAppGuid();
@@ -52,8 +51,7 @@ class GoogleChromeDistribution : public BrowserDistribution {
// install_status: if 0, means installation was successful.
// value: current value of Google Update "ap" key.
std::wstring GetNewGoogleUpdateApKey(bool diff_install,
- installer_util::InstallStatus status,
- const std::wstring& value);
+ installer_util::InstallStatus status, const std::wstring& value);
virtual std::wstring GetPublisherName();
@@ -102,12 +100,12 @@ class GoogleChromeDistribution : public BrowserDistribution {
// has GET parameters, i.e. &metric1=foo&metric2=bar.
// Returns true if uninstall_metrics has been successfully populated with
// the uninstall metrics, false otherwise.
- virtual bool ExtractUninstallMetricsFromFile(const FilePath& file_path,
- std::wstring* uninstall_metrics);
+ virtual bool ExtractUninstallMetricsFromFile(
+ const std::wstring& file_path, std::wstring* uninstall_metrics);
// Extracts uninstall metrics from the given JSON value.
virtual bool ExtractUninstallMetrics(const DictionaryValue& root,
- std::wstring* uninstall_metrics);
+ std::wstring* uninstall_metrics);
// Given a DictionaryValue containing a set of uninstall metrics,
// this builds a URL parameter list of all the contained metrics.
diff --git a/chrome/installer/util/helper.cc b/chrome/installer/util/helper.cc
index a2038c4..af18e9e 100644
--- a/chrome/installer/util/helper.cc
+++ b/chrome/installer/util/helper.cc
@@ -18,8 +18,8 @@
namespace {
-FilePath GetChromeInstallBasePath(bool system_install,
- const wchar_t* subpath) {
+std::wstring GetChromeInstallBasePath(bool system_install,
+ const wchar_t* subpath) {
FilePath install_path;
if (system_install) {
PathService::Get(base::DIR_PROGRAM_FILES, &install_path);
@@ -31,42 +31,41 @@ FilePath GetChromeInstallBasePath(bool system_install,
install_path = install_path.Append(dist->GetInstallSubDir());
install_path = install_path.Append(subpath);
}
- return install_path;
+ return install_path.ToWStringHack();
}
} // namespace
-FilePath installer::GetChromeInstallPath(bool system_install) {
+std::wstring installer::GetChromeInstallPath(bool system_install) {
return GetChromeInstallBasePath(system_install,
installer_util::kInstallBinaryDir);
}
-FilePath installer::GetChromeUserDataPath() {
+std::wstring installer::GetChromeUserDataPath() {
return GetChromeInstallBasePath(false, installer_util::kInstallUserDataDir);
}
bool installer::LaunchChrome(bool system_install) {
- FilePath chrome_exe(FILE_PATH_LITERAL("\""));
- chrome_exe = chrome_exe.Append(installer::GetChromeInstallPath(
- system_install));
- chrome_exe = chrome_exe.Append(installer_util::kChromeExe);
- chrome_exe = chrome_exe.Append(FILE_PATH_LITERAL("\""));
- return base::LaunchApp(chrome_exe.value(), false, false, NULL);
+ std::wstring chrome_exe(L"\"");
+ chrome_exe.append(installer::GetChromeInstallPath(system_install));
+ file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe);
+ chrome_exe.append(L"\"");
+ return base::LaunchApp(chrome_exe, false, false, NULL);
}
bool installer::LaunchChromeAndWaitForResult(bool system_install,
const std::wstring& options,
int32* exit_code) {
- FilePath chrome_exe(installer::GetChromeInstallPath(system_install));
+ std::wstring chrome_exe(installer::GetChromeInstallPath(system_install));
if (chrome_exe.empty())
return false;
- chrome_exe = chrome_exe.Append(installer_util::kChromeExe);
+ file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe);
- std::wstring command_line(L"\"" + chrome_exe.value() + L"\"");
+ std::wstring command_line(L"\"" + chrome_exe + L"\"");
command_line.append(options);
STARTUPINFOW si = {sizeof(si)};
PROCESS_INFORMATION pi = {0};
- if (!::CreateProcessW(chrome_exe.value().c_str(),
+ if (!::CreateProcessW(chrome_exe.c_str(),
const_cast<wchar_t*>(command_line.c_str()),
NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL,
&si, &pi)) {
@@ -86,13 +85,13 @@ bool installer::LaunchChromeAndWaitForResult(bool system_install,
return true;
}
-void installer::RemoveOldVersionDirs(const FilePath& chrome_path,
+void installer::RemoveOldVersionDirs(const std::wstring& chrome_path,
const std::wstring& latest_version_str) {
- FilePath search_path(chrome_path.AppendASCII("*"));
+ std::wstring search_path(chrome_path);
+ file_util::AppendToPath(&search_path, L"*");
WIN32_FIND_DATA find_file_data;
- HANDLE file_handle = FindFirstFile(search_path.value().c_str(),
- &find_file_data);
+ HANDLE file_handle = FindFirstFile(search_path.c_str(), &find_file_data);
if (file_handle == INVALID_HANDLE_VALUE)
return;
@@ -109,9 +108,11 @@ void installer::RemoveOldVersionDirs(const FilePath& chrome_path,
version.reset(
installer::Version::GetVersionFromString(find_file_data.cFileName));
if (version.get() && latest_version->IsHigherThan(version.get())) {
- FilePath remove_dir(chrome_path.Append(find_file_data.cFileName));
- FilePath chrome_dll_path(remove_dir.Append(installer_util::kChromeDll));
- LOG(INFO) << "deleting directory " << remove_dir.value();
+ std::wstring remove_dir(chrome_path);
+ file_util::AppendToPath(&remove_dir, find_file_data.cFileName);
+ std::wstring chrome_dll_path(remove_dir);
+ file_util::AppendToPath(&chrome_dll_path, installer_util::kChromeDll);
+ LOG(INFO) << "deleting directory " << remove_dir;
scoped_ptr<DeleteTreeWorkItem> item;
item.reset(WorkItem::CreateDeleteTreeWorkItem(remove_dir,
chrome_dll_path));
diff --git a/chrome/installer/util/helper.h b/chrome/installer/util/helper.h
index 975ec8a..132d718 100644
--- a/chrome/installer/util/helper.h
+++ b/chrome/installer/util/helper.h
@@ -9,8 +9,6 @@
#include <string>
-class FilePath;
-
namespace installer {
// This function returns the install path for Chrome depending on whether its
@@ -18,13 +16,13 @@ namespace installer {
// system_install: if true, the function returns system wide location
// (ProgramFiles\Google). Otherwise it returns user specific
// location (Document And Settings\<user>\Local Settings...)
-FilePath GetChromeInstallPath(bool system_install);
+std::wstring GetChromeInstallPath(bool system_install);
// This function returns the path to the directory that holds the user data,
// this is always inside "Document And Settings\<user>\Local Settings.". Note
// that this is the default user data directory and does not take into account
// that it can be overriden with a command line parameter.
-FilePath GetChromeUserDataPath();
+std::wstring GetChromeUserDataPath();
// Launches Chrome without waiting for its exit.
bool LaunchChrome(bool system_install);
@@ -44,7 +42,7 @@ bool LaunchChromeAndWaitForResult(bool system_install,
//
// chrome_path: the root path of Chrome installation.
// latest_version_str: the latest version of Chrome installed.
-void RemoveOldVersionDirs(const FilePath& chrome_path,
+void RemoveOldVersionDirs(const std::wstring& chrome_path,
const std::wstring& latest_version_str);
} // namespace installer
diff --git a/chrome/installer/util/helper_unittest.cc b/chrome/installer/util/helper_unittest.cc
index fa297a5..6ccbd29 100644
--- a/chrome/installer/util/helper_unittest.cc
+++ b/chrome/installer/util/helper_unittest.cc
@@ -105,7 +105,7 @@ TEST_F(SetupHelperTest, Delete) {
ASSERT_TRUE(file_util::PathExists(chrome_dll_4));
std::wstring latest_version(L"1.0.4.0");
- installer::RemoveOldVersionDirs(chrome_dir, latest_version);
+ installer::RemoveOldVersionDirs(chrome_dir.value(), latest_version);
// old versions should be gone
EXPECT_FALSE(file_util::PathExists(chrome_dir_1));
@@ -178,7 +178,7 @@ TEST_F(SetupHelperTest, DeleteInUsed) {
ASSERT_TRUE(file_util::PathExists(chrome_dll_4));
std::wstring latest_version(L"1.0.4.0");
- installer::RemoveOldVersionDirs(chrome_dir, latest_version);
+ installer::RemoveOldVersionDirs(chrome_dir.value(), latest_version);
// old versions not in used should be gone
EXPECT_FALSE(file_util::PathExists(chrome_dir_1));
diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc
index a7ac607..e03c25b 100644
--- a/chrome/installer/util/logging_installer.cc
+++ b/chrome/installer/util/logging_installer.cc
@@ -50,7 +50,8 @@ void EndInstallerLogging() {
}
std::wstring GetLogFilePath(const CommandLine& command_line) {
- if (command_line.HasSwitch(WideToASCII(installer_util::switches::kLogFile))) {
+ if (command_line.HasSwitch(
+ WideToASCII(installer_util::switches::kLogFile))) {
return command_line.GetSwitchValue(
WideToASCII(installer_util::switches::kLogFile));
}
@@ -63,9 +64,10 @@ std::wstring GetLogFilePath(const CommandLine& command_line) {
}
FilePath log_path;
+
if (PathService::Get(base::DIR_TEMP, &log_path)) {
log_path = log_path.Append(log_filename);
- return log_path.value();
+ return log_path.ToWStringHack();
} else {
return log_filename;
}
diff --git a/chrome/installer/util/move_tree_work_item.cc b/chrome/installer/util/move_tree_work_item.cc
index be5b7af..45c03b2 100644
--- a/chrome/installer/util/move_tree_work_item.cc
+++ b/chrome/installer/util/move_tree_work_item.cc
@@ -14,9 +14,9 @@ MoveTreeWorkItem::~MoveTreeWorkItem() {
}
}
-MoveTreeWorkItem::MoveTreeWorkItem(const FilePath& source_path,
- const FilePath& dest_path,
- const FilePath& temp_dir)
+MoveTreeWorkItem::MoveTreeWorkItem(const std::wstring& source_path,
+ const std::wstring& dest_path,
+ const std::wstring& temp_dir)
: source_path_(source_path),
dest_path_(dest_path),
temp_dir_(temp_dir),
diff --git a/chrome/installer/util/move_tree_work_item.h b/chrome/installer/util/move_tree_work_item.h
index 1ab3644..cfa86c4 100644
--- a/chrome/installer/util/move_tree_work_item.h
+++ b/chrome/installer/util/move_tree_work_item.h
@@ -33,9 +33,9 @@ class MoveTreeWorkItem : public WorkItem {
// specified by dest_path. To facilitate rollback, the caller needs to supply
// a temporary directory (temp_dir) to save the original files if they exist
// under dest_path.
- MoveTreeWorkItem(const FilePath& source_path,
- const FilePath& dest_path,
- const FilePath& temp_dir);
+ MoveTreeWorkItem(const std::wstring& source_path,
+ const std::wstring& dest_path,
+ const std::wstring& temp_dir);
// Source path to move files from.
FilePath source_path_;
diff --git a/chrome/installer/util/move_tree_work_item_unittest.cc b/chrome/installer/util/move_tree_work_item_unittest.cc
index 90e6c2b..9662b18 100644
--- a/chrome/installer/util/move_tree_work_item_unittest.cc
+++ b/chrome/installer/util/move_tree_work_item_unittest.cc
@@ -27,11 +27,11 @@ namespace {
// Create a fresh, empty copy of this test directory.
file_util::Delete(test_dir_, true);
- file_util::CreateDirectory(test_dir_);
+ file_util::CreateDirectoryW(test_dir_);
// Create a tempory directory under the test directory.
temp_dir_ = test_dir_.AppendASCII("temp");
- file_util::CreateDirectory(temp_dir_);
+ file_util::CreateDirectoryW(temp_dir_);
ASSERT_TRUE(file_util::PathExists(test_dir_));
ASSERT_TRUE(file_util::PathExists(temp_dir_));
@@ -104,7 +104,8 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectory) {
// test Do()
scoped_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_dir1, to_dir, temp_dir_));
+ from_dir1.ToWStringHack(), to_dir.ToWStringHack(),
+ temp_dir_.ToWStringHack()));
EXPECT_TRUE(work_item->Do());
EXPECT_FALSE(file_util::PathExists(from_dir1));
@@ -156,7 +157,8 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExists) {
// test Do()
scoped_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_dir1, to_dir, temp_dir_));
+ from_dir1.ToWStringHack(), to_dir.ToWStringHack(),
+ temp_dir_.ToWStringHack()));
EXPECT_TRUE(work_item->Do());
EXPECT_FALSE(file_util::PathExists(from_dir1));
@@ -197,7 +199,8 @@ TEST_F(MoveTreeWorkItemTest, MoveAFile) {
// test Do()
scoped_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_file, to_file, temp_dir_));
+ from_file.ToWStringHack(), to_file.ToWStringHack(),
+ temp_dir_.ToWStringHack()));
EXPECT_TRUE(work_item->Do());
EXPECT_TRUE(file_util::PathExists(from_dir));
@@ -241,7 +244,8 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestExists) {
// test Do()
scoped_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_file, to_dir, temp_dir_));
+ from_file.ToWStringHack(), to_dir.ToWStringHack(),
+ temp_dir_.ToWStringHack()));
EXPECT_TRUE(work_item->Do());
EXPECT_TRUE(file_util::PathExists(from_dir));
@@ -298,7 +302,8 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) {
// test Do()
scoped_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_file, to_file, temp_dir_));
+ from_file.ToWStringHack(), to_file.ToWStringHack(),
+ temp_dir_.ToWStringHack()));
EXPECT_TRUE(work_item->Do());
EXPECT_TRUE(file_util::PathExists(from_dir));
@@ -358,7 +363,8 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) {
// test Do()
scoped_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_file, to_file, temp_dir_));
+ from_file.ToWStringHack(), to_file.ToWStringHack(),
+ temp_dir_.ToWStringHack()));
EXPECT_TRUE(work_item->Do());
EXPECT_TRUE(file_util::PathExists(from_dir));
diff --git a/chrome/installer/util/work_item.cc b/chrome/installer/util/work_item.cc
index 1c337e1..af14379 100644
--- a/chrome/installer/util/work_item.cc
+++ b/chrome/installer/util/work_item.cc
@@ -21,11 +21,11 @@ WorkItem::~WorkItem() {
}
CopyTreeWorkItem* WorkItem::CreateCopyTreeWorkItem(
- const FilePath& source_path,
- const FilePath& dest_path,
- const FilePath& temp_dir,
+ const std::wstring& source_path,
+ const std::wstring& dest_path,
+ const std::wstring& temp_dir,
CopyOverWriteOption overwrite_option,
- const FilePath& alternative_path) {
+ const std::wstring& alternative_path) {
return new CopyTreeWorkItem(source_path, dest_path, temp_dir,
overwrite_option, alternative_path);
}
@@ -49,14 +49,14 @@ DeleteRegValueWorkItem* WorkItem::CreateDeleteRegValueWorkItem(
}
DeleteTreeWorkItem* WorkItem::CreateDeleteTreeWorkItem(
- const FilePath& root_path, const FilePath& key_path) {
+ const std::wstring& root_path, const std::wstring& key_path) {
return new DeleteTreeWorkItem(root_path, key_path);
}
MoveTreeWorkItem* WorkItem::CreateMoveTreeWorkItem(
- const FilePath& source_path,
- const FilePath& dest_path,
- const FilePath& temp_dir) {
+ const std::wstring& source_path,
+ const std::wstring& dest_path,
+ const std::wstring& temp_dir) {
return new MoveTreeWorkItem(source_path, dest_path, temp_dir);
}
diff --git a/chrome/installer/util/work_item.h b/chrome/installer/util/work_item.h
index 45b72ae..9a61363 100644
--- a/chrome/installer/util/work_item.h
+++ b/chrome/installer/util/work_item.h
@@ -46,11 +46,11 @@ class WorkItem {
// * If overwrite_option is NEW_NAME_IF_IN_USE, file is copied with an
// alternate name specified by alternative_path.
static CopyTreeWorkItem* CreateCopyTreeWorkItem(
- const FilePath& source_path,
- const FilePath& dest_path,
- const FilePath& temp_dir,
+ const std::wstring& source_path,
+ const std::wstring& dest_path,
+ const std::wstring& temp_dir,
CopyOverWriteOption overwrite_option,
- const FilePath& alternative_path = FilePath());
+ const std::wstring& alternative_path = L"");
// Create a CreateDirWorkItem that creates a directory at the given path.
static CreateDirWorkItem* CreateCreateDirWorkItem(const FilePath& path);
@@ -71,14 +71,14 @@ class WorkItem {
// hierarchy at the given root path. A key file can be optionally specified
// by key_path.
static DeleteTreeWorkItem* CreateDeleteTreeWorkItem(
- const FilePath& root_path, const FilePath& key_path);
+ const std::wstring& root_path, const std::wstring& key_path);
// Create a MoveTreeWorkItem that recursively moves a file system hierarchy
// from source path to destination path.
static MoveTreeWorkItem* CreateMoveTreeWorkItem(
- const FilePath& source_path,
- const FilePath& dest_path,
- const FilePath& temp_dir);
+ const std::wstring& source_path,
+ const std::wstring& dest_path,
+ const std::wstring& temp_dir);
// Create a SetRegValueWorkItem that sets a registry value with REG_SZ type
// at the key with specified path.
diff --git a/chrome/installer/util/work_item_list.cc b/chrome/installer/util/work_item_list.cc
index 76d0dfa..8f4c702 100644
--- a/chrome/installer/util/work_item_list.cc
+++ b/chrome/installer/util/work_item_list.cc
@@ -63,11 +63,11 @@ bool WorkItemList::AddWorkItem(WorkItem* work_item) {
return true;
}
-bool WorkItemList::AddCopyTreeWorkItem(const FilePath& source_path,
- const FilePath& dest_path,
- const FilePath& temp_dir,
+bool WorkItemList::AddCopyTreeWorkItem(const std::wstring& source_path,
+ const std::wstring& dest_path,
+ const std::wstring& temp_dir,
CopyOverWriteOption overwrite_option,
- const FilePath& alternative_path) {
+ const std::wstring& alternative_path) {
WorkItem* item = reinterpret_cast<WorkItem*>(
WorkItem::CreateCopyTreeWorkItem(source_path, dest_path, temp_dir,
overwrite_option, alternative_path));
@@ -97,16 +97,16 @@ bool WorkItemList::AddDeleteRegValueWorkItem(HKEY predefined_root,
return AddWorkItem(item);
}
-bool WorkItemList::AddDeleteTreeWorkItem(const FilePath& root_path,
- const FilePath& key_path) {
+bool WorkItemList::AddDeleteTreeWorkItem(const std::wstring& root_path,
+ const std::wstring& key_path) {
WorkItem* item = reinterpret_cast<WorkItem*>(
WorkItem::CreateDeleteTreeWorkItem(root_path, key_path));
return AddWorkItem(item);
}
-bool WorkItemList::AddMoveTreeWorkItem(const FilePath& source_path,
- const FilePath& dest_path,
- const FilePath& temp_dir) {
+bool WorkItemList::AddMoveTreeWorkItem(const std::wstring& source_path,
+ const std::wstring& dest_path,
+ const std::wstring& temp_dir) {
WorkItem* item = reinterpret_cast<WorkItem*>(
WorkItem::CreateMoveTreeWorkItem(source_path, dest_path, temp_dir));
return AddWorkItem(item);
diff --git a/chrome/installer/util/work_item_list.h b/chrome/installer/util/work_item_list.h
index 71bec61..1390701 100644
--- a/chrome/installer/util/work_item_list.h
+++ b/chrome/installer/util/work_item_list.h
@@ -36,11 +36,11 @@ class WorkItemList : public WorkItem {
bool AddWorkItem(WorkItem* work_item);
// Add a CopyTreeWorkItem to the list of work items.
- bool AddCopyTreeWorkItem(const FilePath& source_path,
- const FilePath& dest_path,
- const FilePath& temp_dir,
+ bool AddCopyTreeWorkItem(const std::wstring& source_path,
+ const std::wstring& dest_path,
+ const std::wstring& temp_dir,
CopyOverWriteOption overwrite_option,
- const FilePath& alternative_path = FilePath());
+ const std::wstring& alternative_path = L"");
// Add a CreateDirWorkItem that creates a directory at the given path.
bool AddCreateDirWorkItem(const FilePath& path);
@@ -59,13 +59,13 @@ class WorkItemList : public WorkItem {
// Add a DeleteTreeWorkItem that recursively deletes a file system
// hierarchy at the given root path. A key file can be optionally specified
// by key_path.
- bool AddDeleteTreeWorkItem(const FilePath& root_path,
- const FilePath& key_path);
+ bool AddDeleteTreeWorkItem(const std::wstring& root_path,
+ const std::wstring& key_path);
// Add a MoveTreeWorkItem to the list of work items.
- bool AddMoveTreeWorkItem(const FilePath& source_path,
- const FilePath& dest_path,
- const FilePath& temp_dir);
+ bool AddMoveTreeWorkItem(const std::wstring& source_path,
+ const std::wstring& dest_path,
+ const std::wstring& temp_dir);
// Add a SetRegValueWorkItem that sets a registry value with REG_SZ type
// at the key with specified path.