OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 #include <windows.h> | 6 #include <windows.h> |
7 #include <msi.h> | 7 #include <msi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 int32 ret = LzmaUtil::UnPackArchive(archive, temp_path, &unpacked_file); | 60 int32 ret = LzmaUtil::UnPackArchive(archive, temp_path, &unpacked_file); |
61 if (ret != NO_ERROR) | 61 if (ret != NO_ERROR) |
62 return ret; | 62 return ret; |
63 | 63 |
64 std::wstring uncompressed_archive(temp_path); | 64 std::wstring uncompressed_archive(temp_path); |
65 file_util::AppendToPath(&uncompressed_archive, installer::kChromeArchive); | 65 file_util::AppendToPath(&uncompressed_archive, installer::kChromeArchive); |
66 | 66 |
67 // Check if this is differential update and if it is, patch it to the | 67 // Check if this is differential update and if it is, patch it to the |
68 // installer archive that should already be on the machine. We assume | 68 // installer archive that should already be on the machine. We assume |
69 // it is a differential installer if chrome.7z is not found. | 69 // it is a differential installer if chrome.7z is not found. |
70 if (!file_util::PathExists(uncompressed_archive)) { | 70 if (!file_util::PathExists(FilePath::FromWStringHack(uncompressed_archive))) { |
71 incremental_install = true; | 71 incremental_install = true; |
72 LOG(INFO) << "Differential patch found. Applying to existing archive."; | 72 LOG(INFO) << "Differential patch found. Applying to existing archive."; |
73 if (!installed_version) { | 73 if (!installed_version) { |
74 LOG(ERROR) << "Can not use differential update when Chrome is not " | 74 LOG(ERROR) << "Can not use differential update when Chrome is not " |
75 << "installed on the system."; | 75 << "installed on the system."; |
76 return installer_util::CHROME_NOT_INSTALLED; | 76 return installer_util::CHROME_NOT_INSTALLED; |
77 } | 77 } |
78 std::wstring existing_archive = | 78 std::wstring existing_archive = |
79 installer::GetChromeInstallPath(system_install); | 79 installer::GetChromeInstallPath(system_install); |
80 file_util::AppendToPath(&existing_archive, | 80 file_util::AppendToPath(&existing_archive, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 int str_id = system_install ? IDS_INSTALL_USER_LEVEL_EXISTS_BASE : | 156 int str_id = system_install ? IDS_INSTALL_USER_LEVEL_EXISTS_BASE : |
157 IDS_INSTALL_SYSTEM_LEVEL_EXISTS_BASE; | 157 IDS_INSTALL_SYSTEM_LEVEL_EXISTS_BASE; |
158 InstallUtil::WriteInstallerResult(system_install, status, str_id, NULL); | 158 InstallUtil::WriteInstallerResult(system_install, status, str_id, NULL); |
159 return false; | 159 return false; |
160 } | 160 } |
161 | 161 |
162 // If no previous installation of Chrome, make sure installation directory | 162 // If no previous installation of Chrome, make sure installation directory |
163 // either does not exist or can be deleted (i.e. is not locked by some other | 163 // either does not exist or can be deleted (i.e. is not locked by some other |
164 // process). | 164 // process). |
165 if (!installed_version) { | 165 if (!installed_version) { |
166 std::wstring install_path(installer::GetChromeInstallPath(system_install)); | 166 FilePath install_path = FilePath::FromWStringHack( |
| 167 installer::GetChromeInstallPath(system_install)); |
167 if (file_util::PathExists(install_path) && | 168 if (file_util::PathExists(install_path) && |
168 !file_util::Delete(install_path, true)) { | 169 !file_util::Delete(install_path, true)) { |
169 LOG(ERROR) << "Installation directory " << install_path | 170 LOG(ERROR) << "Installation directory " << install_path.value() |
170 << " exists and can not be deleted."; | 171 << " exists and can not be deleted."; |
171 status = installer_util::INSTALL_DIR_IN_USE; | 172 status = installer_util::INSTALL_DIR_IN_USE; |
172 int str_id = IDS_INSTALL_DIR_IN_USE_BASE; | 173 int str_id = IDS_INSTALL_DIR_IN_USE_BASE; |
173 InstallUtil::WriteInstallerResult(system_install, status, str_id, NULL); | 174 InstallUtil::WriteInstallerResult(system_install, status, str_id, NULL); |
174 return false; | 175 return false; |
175 } | 176 } |
176 } | 177 } |
177 | 178 |
178 return true; | 179 return true; |
179 } | 180 } |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 #if defined(CHROME_FRAME_BUILD) | 592 #if defined(CHROME_FRAME_BUILD) |
592 ShowRebootDialog(); | 593 ShowRebootDialog(); |
593 #endif | 594 #endif |
594 } | 595 } |
595 | 596 |
596 CoUninitialize(); | 597 CoUninitialize(); |
597 | 598 |
598 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 599 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
599 return dist->GetInstallReturnCode(install_status); | 600 return dist->GetInstallReturnCode(install_status); |
600 } | 601 } |
OLD | NEW |