summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-11 16:54:26 +0000
committerrahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-11 16:54:26 +0000
commit78b1722653b794a0a68f0cc473fc1855b95517ae (patch)
treed56b107781e612599a0cf04b1745b988645bff9e
parent4d0cd7ce8c91a2c0157ecf9e0a5153712ff43d10 (diff)
downloadchromium_src-78b1722653b794a0a68f0cc473fc1855b95517ae.zip
chromium_src-78b1722653b794a0a68f0cc473fc1855b95517ae.tar.gz
chromium_src-78b1722653b794a0a68f0cc473fc1855b95517ae.tar.bz2
Cleanup setup.exe:
- Remove various migration code for shortcuts (now 149.13 has been pushed to everybody) - Cleanup error messages that will show up in log file with the default logging level - Remove junk error messages that haven't been helpful at all (delete registry key/valye errors) git-svn-id: svn://svn.chromium.org/chrome/trunk/src@655 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/installer/setup/install.cc3
-rw-r--r--chrome/installer/setup/main.cc16
-rw-r--r--chrome/installer/setup/setup.cc54
-rw-r--r--chrome/installer/setup/uninstall.cc13
-rw-r--r--chrome/installer/util/create_reg_key_work_item.cc3
-rw-r--r--chrome/installer/util/install_util.cc19
-rw-r--r--chrome/installer/util/install_util.h8
7 files changed, 20 insertions, 96 deletions
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index 9cdd58d..1231d77 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -244,8 +244,9 @@ bool installer::InstallNewVersion(const std::wstring& exe_path,
// Perform install operations.
if (!install_list->Do()) {
- LOG(ERROR) << "install failed, roll back... ";
+ LOG(ERROR) << "Install failed, rolling back... ";
install_list->Rollback();
+ LOG(ERROR) << "Rollback complete. ";
return false;
}
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc
index 233408b..67bd872 100644
--- a/chrome/installer/setup/main.cc
+++ b/chrome/installer/setup/main.cc
@@ -122,11 +122,11 @@ DWORD UnPackArchive(const std::wstring& archive, bool system_install,
// return with error.
LOG(INFO) << "Opening archive " << archive;
if ((ret = util.OpenArchive(archive)) != NO_ERROR) {
- LOG(ERROR) << "unable to open install archive: " << archive;
+ LOG(ERROR) << "Unable to open install archive: " << archive;
} else {
LOG(INFO) << "Uncompressing archive to path " << temp_path;
if ((ret = util.UnPack(temp_path)) != NO_ERROR) {
- LOG(ERROR) << "error during uncompression: " << ret;
+ LOG(ERROR) << "Error during uncompression: " << ret;
}
util.CloseArchive();
}
@@ -159,12 +159,12 @@ DWORD UnPackArchive(const std::wstring& archive, bool system_install,
// If we got the uncompressed archive, lets unpack it
LOG(INFO) << "Opening archive " << uncompressed_archive;
if ((ret = util.OpenArchive(uncompressed_archive)) != NO_ERROR) {
- LOG(ERROR) << "unable to open install archive: " <<
+ LOG(ERROR) << "Unable to open install archive: " <<
uncompressed_archive;
} else {
LOG(INFO) << "Unpacking archive to path " << path;
if ((ret = util.UnPack(path)) != NO_ERROR) {
- LOG(ERROR) << "error during uncompression: " << ret;
+ LOG(ERROR) << "Error during uncompression: " << ret;
}
util.CloseArchive();
}
@@ -249,7 +249,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
// Check to make sure current system is WinXP or later. If not, log
// error message and get out.
if (!IsWindowsXPorLater()) {
- LOG(ERROR) << "Chrome only supports Windows XP or later";
+ LOG(ERROR) << "Chrome only supports Windows XP or later.";
return installer_util::OS_NOT_SUPPORTED;
}
@@ -291,7 +291,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
// If --uninstall option is given, uninstall chrome
LOG(INFO) << "Uninstalling Chome";
if (!installed_version.get()) {
- LOG(ERROR) << "No Chrome installation found for uninstall";
+ LOG(ERROR) << "No Chrome installation found for uninstall.";
install_status = installer_util::CHROME_NOT_INSTALLED;
} else {
install_status = installer_setup::UninstallChrome(
@@ -319,7 +319,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
std::wstring install_temp_path;
if (!file_util::CreateNewTempDirectory(std::wstring(L"chrome_"),
&install_temp_path)) {
- LOG(ERROR) << "can not create temporary path";
+ LOG(ERROR) << "Could not create temporary path.";
return installer_util::TEMP_DIR_FAILED;
}
LOG(INFO) << "created path " << install_temp_path;
@@ -339,7 +339,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
scoped_ptr<installer::Version>
installer_version(GetVersionFromDir(src_path));
if (!installer_version.get()) {
- LOG(ERROR) << "didn't find any valid version in installer";
+ LOG(ERROR) << "Did not find any valid version in installer.";
install_status = installer_util::INVALID_ARCHIVE;
} else {
LOG(INFO) << "version to be installed: " <<
diff --git a/chrome/installer/setup/setup.cc b/chrome/installer/setup/setup.cc
index f36f58b..d82018b 100644
--- a/chrome/installer/setup/setup.cc
+++ b/chrome/installer/setup/setup.cc
@@ -60,28 +60,10 @@ void AddChromeToMediaPlayerList() {
// if the operation fails we log the error but still continue
if (!work_item.get()->Do())
- LOG(ERROR) << "Couldn't add Chrome to media player inclusion list.";
+ LOG(ERROR) << "Could not add Chrome to media player inclusion list.";
}
-// If we ever rename Chrome shortcuts under Windows Start menu, this
-// function deletes any of the old Chrome shortcuts if they exist. This
-// function will probably contain hard coded names of old shortcuts as they
-// will not longer be used anywhere else.
-// Method returns true if it finds and deletes successfully any old shortcut,
-// in all other cases it returns false.
-bool DeleteOldShortcuts(const std::wstring shortcut_path) {
- // Check for the existence of shortcuts when they were still created under
- // Start->Programs->Chrome (as opposed to Start->Programs->Google Chrome).
- std::wstring shortcut_folder(shortcut_path);
- file_util::AppendToPath(&shortcut_folder, L"Chrome");
- if (file_util::PathExists(shortcut_folder)) {
- LOG(INFO) << "Old shortcut path " << shortcut_folder << " exists.";
- return file_util::Delete(shortcut_folder, true);
- }
- return false;
-}
-
// Update shortcuts that are created by chrome.exe during first run, but
// we take care of updating them in case the location of chrome.exe changes.
void UpdateChromeExeShortcuts(const std::wstring& chrome_exe) {
@@ -90,26 +72,9 @@ void UpdateChromeExeShortcuts(const std::wstring& chrome_exe) {
!ShellUtil::GetDesktopPath(&desktop_shortcut) ||
!ShellUtil::GetChromeShortcutName(&shortcut_name))
return;
- // Migrate the old shortcuts from Chrome.lnk to the localized name.
- std::wstring old_ql_shortcut = ql_shortcut;
- file_util::AppendToPath(&old_ql_shortcut, L"Chrome.lnk");
file_util::AppendToPath(&ql_shortcut, shortcut_name);
- std::wstring old_desktop_shortcut = desktop_shortcut;
- file_util::AppendToPath(&old_desktop_shortcut, L"Chrome.lnk");
file_util::AppendToPath(&desktop_shortcut, shortcut_name);
- if (file_util::Move(old_ql_shortcut, ql_shortcut)) {
- // Notify the Windows Shell that we renamed the file so it can remove the
- // old icon. It's safe to not cehck for MAX_PATH because file_util::Move
- // does the check for us.
- SHChangeNotify(SHCNE_RENAMEITEM, SHCNF_PATH, old_ql_shortcut.c_str(),
- ql_shortcut.c_str());
- }
- if (file_util::Move(old_desktop_shortcut, desktop_shortcut)) {
- SHChangeNotify(SHCNE_RENAMEITEM, SHCNF_PATH, old_desktop_shortcut.c_str(),
- desktop_shortcut.c_str());
- }
-
// Go ahead and update the shortcuts if they exist.
ShellUtil::UpdateChromeShortcut(chrome_exe, ql_shortcut, false);
ShellUtil::UpdateChromeShortcut(chrome_exe, desktop_shortcut, false);
@@ -142,9 +107,6 @@ bool CreateOrUpdateChromeShortcuts(const std::wstring& exe_path,
return false;
}
- // Check for existence of old shortcuts
- bool old_shortcuts_existed = DeleteOldShortcuts(shortcut_path);
-
// The location of Start->Programs->Google Chrome folder
const std::wstring& product_name =
installer_util::GetLocalizedString(IDS_PRODUCT_NAME_BASE);
@@ -164,8 +126,7 @@ bool CreateOrUpdateChromeShortcuts(const std::wstring& exe_path,
file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe);
if ((install_status == installer_util::FIRST_INSTALL_SUCCESS) ||
- (install_status == installer_util::INSTALL_REPAIRED) ||
- (old_shortcuts_existed)) {
+ (install_status == installer_util::INSTALL_REPAIRED)) {
if (!file_util::PathExists(shortcut_path))
file_util::CreateDirectoryW(shortcut_path);
@@ -185,7 +146,6 @@ bool CreateOrUpdateChromeShortcuts(const std::wstring& exe_path,
installer_util::GetLocalizedString(IDS_UNINSTALL_CHROME_BASE) + L".lnk");
if ((install_status == installer_util::FIRST_INSTALL_SUCCESS) ||
(install_status == installer_util::INSTALL_REPAIRED) ||
- (old_shortcuts_existed) ||
(file_util::PathExists(uninstall_link))) {
if (!file_util::PathExists(shortcut_path))
file_util::CreateDirectoryW(shortcut_path);
@@ -230,7 +190,7 @@ installer_util::InstallStatus installer::InstallOrUpdateChrome(
std::wstring install_path(GetChromeInstallPath(system_install));
if (install_path.empty()) {
- LOG(ERROR) << "Couldn't get installation destination path";
+ LOG(ERROR) << "Could not get installation destination path.";
return installer_util::INSTALL_FAILED;
} else {
LOG(INFO) << "install destination path: " << install_path;
@@ -280,15 +240,9 @@ installer_util::InstallStatus installer::InstallOrUpdateChrome(
LOG(INFO) << "Registering Chrome as browser";
ShellUtil::RegisterStatus ret =
ShellUtil::AddChromeToSetAccessDefaults(chrome_exe, true);
- LOG(ERROR) << "Return status of Chrome browser registration " << ret;
+ LOG(INFO) << "Return status of Chrome browser registration " << ret;
} else {
- UpdateChromeExeShortcuts(chrome_exe);
RemoveOldVersionDirs(install_path, new_version.GetString());
- // Delete the old key for Uninstall link (this code can be removed once
- // everyone has migrated to the new "Google Chrome" version of the key).
- RegKey key(reg_root, L"", KEY_ALL_ACCESS);
- key.DeleteKey(L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Chrome");
- key.Close();
}
}
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index d742e62..0be9b04 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -71,7 +71,7 @@ void DeleteChromeShortcut(bool system_uninstall) {
PathService::Get(base::DIR_START_MENU, &shortcut_path);
}
if (shortcut_path.empty()) {
- LOG(ERROR) << "failed to get location for shortcut";
+ LOG(ERROR) << "Failed to get location for shortcut.";
} else {
file_util::AppendToPath(&shortcut_path,
installer_util::GetLocalizedString(IDS_PRODUCT_NAME_BASE));
@@ -87,8 +87,7 @@ void DeleteChromeShortcut(bool system_uninstall) {
bool DeleteRegistryKey(RegKey& key, const std::wstring& key_path) {
LOG(INFO) << "Deleting registry key " << key_path;
if (!key.DeleteKey(key_path.c_str())) {
- LOG(ERROR) << "Failed to delete registry key: " << key_path
- << " and the error is " << InstallUtil::FormatLastWin32Error();
+ LOG(ERROR) << "Failed to delete registry key: " << key_path;
return false;
}
return true;
@@ -102,8 +101,7 @@ bool DeleteRegistryValue(HKEY reg_root, const std::wstring& key_path,
RegKey key(reg_root, key_path.c_str(), KEY_ALL_ACCESS);
LOG(INFO) << "Deleting registry value " << value_name;
if (!key.DeleteValue(value_name.c_str())) {
- LOG(ERROR) << "Failed to delete registry value: " << value_name
- << " and the error is " << InstallUtil::FormatLastWin32Error();
+ LOG(ERROR) << "Failed to delete registry value: " << value_name;
return false;
}
return true;
@@ -216,8 +214,7 @@ void UninstallGears() {
unsigned int ret = MsiConfigureProduct(product, INSTALLLEVEL_MAXIMUM,
INSTALLSTATE_ABSENT);
if (ret != ERROR_SUCCESS)
- LOG(ERROR) << "Failed to uninstall Gears " << product
- << " because of error " << ret;
+ LOG(ERROR) << "Failed to uninstall Gears " << product << ": " << ret;
}
}
@@ -283,7 +280,7 @@ installer_util::InstallStatus installer_setup::UninstallChrome(
// to a temp location.
std::wstring install_path(installer::GetChromeInstallPath(system_uninstall));
if (install_path.empty()) {
- LOG(ERROR) << "Couldn't get installation destination path";
+ LOG(ERROR) << "Could not get installation destination path.";
// Nothing else we could do for uninstall, so we return.
return installer_util::UNINSTALL_FAILED;
} else {
diff --git a/chrome/installer/util/create_reg_key_work_item.cc b/chrome/installer/util/create_reg_key_work_item.cc
index 719a4207a..9acd86c 100644
--- a/chrome/installer/util/create_reg_key_work_item.cc
+++ b/chrome/installer/util/create_reg_key_work_item.cc
@@ -80,8 +80,7 @@ bool CreateRegKeyWorkItem::Do() {
return false;
}
} else {
- LOG(ERROR) << "fail to create " << key_path << " and the error is: "
- << InstallUtil::FormatLastWin32Error();
+ LOG(ERROR) << "Failed to create " << key_path;
return false;
}
}
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index 6424bd6..087589b 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -40,25 +40,6 @@
#include "chrome/installer/util/google_update_constants.h"
-std::wstring InstallUtil::FormatLastWin32Error() {
- unsigned messageid = GetLastError();
- wchar_t* string_buffer = NULL;
- unsigned string_length = ::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, messageid, 0, reinterpret_cast<wchar_t *>(&string_buffer), 0, NULL);
-
- std::wstring formatted_string;
- if (string_buffer) {
- formatted_string = string_buffer;
- LocalFree(reinterpret_cast<HLOCAL>(string_buffer));
- } else {
- // The formating failed. simply convert the message value into a string.
- SStringPrintf(&formatted_string, L"message number %d", messageid);
- }
- return formatted_string;
-}
-
-
std::wstring InstallUtil::GetChromeGoogleUpdateKey() {
std::wstring chrome_google_update_key(google_update::kRegPathClients);
chrome_google_update_key.append(L"\\");
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index 8ef79bf..69884e9 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -45,14 +45,6 @@
// independently.
class InstallUtil {
public:
- // Gets the last Win32 error and generates a human readable message string.
- // Uses the Win32 API GetLastError() to get the last error and API
- // FormatMessage() to generate a string. This function has been copied
- // from chrome\common\win_util.{h.cc} to avoid making setup.exe dependent
- // on all the other libs (base_gfx, libjpeg, libpng and others) that we
- // need to pull in and the size of setup.exe goes up by ~140KB.
- static std::wstring FormatLastWin32Error();
-
// This method gets the Google Update registry key path for Chrome.
// i.e. - Software\Google\Update\Clients\<chrome-guid>";
static std::wstring GetChromeGoogleUpdateKey();