OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <time.h> | 5 #include <time.h> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/installer/setup/setup.h" | 10 #include "chrome/installer/setup/setup.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 const std::wstring& product_name, | 43 const std::wstring& product_name, |
44 const std::wstring& new_version, | 44 const std::wstring& new_version, |
45 WorkItemList* install_list) { | 45 WorkItemList* install_list) { |
46 std::wstring uninstall_cmd(L"\""); | 46 std::wstring uninstall_cmd(L"\""); |
47 uninstall_cmd.append(installer::GetInstallerPathUnderChrome(install_path, | 47 uninstall_cmd.append(installer::GetInstallerPathUnderChrome(install_path, |
48 new_version)); | 48 new_version)); |
49 file_util::AppendToPath(&uninstall_cmd, | 49 file_util::AppendToPath(&uninstall_cmd, |
50 file_util::GetFilenameFromPath(exe_path)); | 50 file_util::GetFilenameFromPath(exe_path)); |
51 uninstall_cmd.append(L"\" --"); | 51 uninstall_cmd.append(L"\" --"); |
52 uninstall_cmd.append(installer_util::switches::kUninstall); | 52 uninstall_cmd.append(installer_util::switches::kUninstall); |
| 53 if (reg_root == HKEY_LOCAL_MACHINE) { |
| 54 uninstall_cmd.append(L" --"); |
| 55 uninstall_cmd.append(installer_util::switches::kSystemInstall); |
| 56 } |
53 | 57 |
54 // Create DisplayName, UninstallString and InstallLocation keys | 58 // Create DisplayName, UninstallString and InstallLocation keys |
55 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 59 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
56 std::wstring uninstall_reg = dist->GetUninstallRegPath(); | 60 std::wstring uninstall_reg = dist->GetUninstallRegPath(); |
57 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); | 61 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); |
58 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 62 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
59 installer_util::kUninstallDisplayNameField, product_name, true); | 63 installer_util::kUninstallDisplayNameField, product_name, true); |
60 install_list->AddSetRegValueWorkItem(reg_root, | 64 install_list->AddSetRegValueWorkItem(reg_root, |
61 uninstall_reg, | 65 uninstall_reg, |
62 installer_util::kUninstallStringField, | 66 installer_util::kUninstallStringField, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 if (!install_list->Do()) { | 219 if (!install_list->Do()) { |
216 LOG(ERROR) << "Install failed, rolling back... "; | 220 LOG(ERROR) << "Install failed, rolling back... "; |
217 install_list->Rollback(); | 221 install_list->Rollback(); |
218 LOG(ERROR) << "Rollback complete. "; | 222 LOG(ERROR) << "Rollback complete. "; |
219 return false; | 223 return false; |
220 } | 224 } |
221 | 225 |
222 return true; | 226 return true; |
223 } | 227 } |
224 | 228 |
OLD | NEW |