OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <windows.h> | 5 #include <windows.h> |
6 #include <msi.h> | 6 #include <msi.h> |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/file_version_info.h" | 14 #include "base/file_version_info.h" |
| 15 #include "base/files/scoped_temp_dir.h" |
15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
16 #include "base/process_util.h" | 17 #include "base/process_util.h" |
17 #include "base/scoped_temp_dir.h" | |
18 #include "base/string16.h" | 18 #include "base/string16.h" |
19 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
22 #include "base/values.h" | 22 #include "base/values.h" |
23 #include "base/win/registry.h" | 23 #include "base/win/registry.h" |
24 #include "base/win/scoped_com_initializer.h" | 24 #include "base/win/scoped_com_initializer.h" |
25 #include "base/win/scoped_comptr.h" | 25 #include "base/win/scoped_comptr.h" |
26 #include "base/win/scoped_handle.h" | 26 #include "base/win/scoped_handle.h" |
27 #include "base/win/win_util.h" | 27 #include "base/win/win_util.h" |
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 // (!handled || status != installer::UNKNOWN_STATUS)). | 1159 // (!handled || status != installer::UNKNOWN_STATUS)). |
1160 bool handled = true; | 1160 bool handled = true; |
1161 // TODO(tommi): Split these checks up into functions and use a data driven | 1161 // TODO(tommi): Split these checks up into functions and use a data driven |
1162 // map of switch->function. | 1162 // map of switch->function. |
1163 if (cmd_line.HasSwitch(installer::switches::kUpdateSetupExe)) { | 1163 if (cmd_line.HasSwitch(installer::switches::kUpdateSetupExe)) { |
1164 installer::InstallStatus status = installer::SETUP_PATCH_FAILED; | 1164 installer::InstallStatus status = installer::SETUP_PATCH_FAILED; |
1165 // If --update-setup-exe command line option is given, we apply the given | 1165 // If --update-setup-exe command line option is given, we apply the given |
1166 // patch to current exe, and store the resulting binary in the path | 1166 // patch to current exe, and store the resulting binary in the path |
1167 // specified by --new-setup-exe. But we need to first unpack the file | 1167 // specified by --new-setup-exe. But we need to first unpack the file |
1168 // given in --update-setup-exe. | 1168 // given in --update-setup-exe. |
1169 ScopedTempDir temp_path; | 1169 base::ScopedTempDir temp_path; |
1170 if (!temp_path.CreateUniqueTempDir()) { | 1170 if (!temp_path.CreateUniqueTempDir()) { |
1171 PLOG(ERROR) << "Could not create temporary path."; | 1171 PLOG(ERROR) << "Could not create temporary path."; |
1172 } else { | 1172 } else { |
1173 string16 setup_patch = cmd_line.GetSwitchValueNative( | 1173 string16 setup_patch = cmd_line.GetSwitchValueNative( |
1174 installer::switches::kUpdateSetupExe); | 1174 installer::switches::kUpdateSetupExe); |
1175 VLOG(1) << "Opening archive " << setup_patch; | 1175 VLOG(1) << "Opening archive " << setup_patch; |
1176 string16 uncompressed_patch; | 1176 string16 uncompressed_patch; |
1177 if (LzmaUtil::UnPackArchive(setup_patch, temp_path.path().value(), | 1177 if (LzmaUtil::UnPackArchive(setup_patch, temp_path.path().value(), |
1178 &uncompressed_patch) == NO_ERROR) { | 1178 &uncompressed_patch) == NO_ERROR) { |
1179 FilePath old_setup_exe = cmd_line.GetProgram(); | 1179 FilePath old_setup_exe = cmd_line.GetProgram(); |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 if (!(installer_state.is_msi() && is_uninstall)) | 1638 if (!(installer_state.is_msi() && is_uninstall)) |
1639 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1639 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
1640 // to pass through, since this is only returned on uninstall which is | 1640 // to pass through, since this is only returned on uninstall which is |
1641 // never invoked directly by Google Update. | 1641 // never invoked directly by Google Update. |
1642 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1642 return_code = InstallUtil::GetInstallReturnCode(install_status); |
1643 | 1643 |
1644 VLOG(1) << "Installation complete, returning: " << return_code; | 1644 VLOG(1) << "Installation complete, returning: " << return_code; |
1645 | 1645 |
1646 return return_code; | 1646 return return_code; |
1647 } | 1647 } |
OLD | NEW |