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 "chrome/installer/setup/setup_main.h" | 5 #include "chrome/installer/setup/setup_main.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <msi.h> | 8 #include <msi.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/installer/setup/archive_patch_helper.h" | 44 #include "chrome/installer/setup/archive_patch_helper.h" |
45 #include "chrome/installer/setup/install.h" | 45 #include "chrome/installer/setup/install.h" |
46 #include "chrome/installer/setup/install_worker.h" | 46 #include "chrome/installer/setup/install_worker.h" |
47 #include "chrome/installer/setup/installer_crash_reporting.h" | 47 #include "chrome/installer/setup/installer_crash_reporting.h" |
48 #include "chrome/installer/setup/installer_metrics.h" | 48 #include "chrome/installer/setup/installer_metrics.h" |
49 #include "chrome/installer/setup/setup_constants.h" | 49 #include "chrome/installer/setup/setup_constants.h" |
50 #include "chrome/installer/setup/setup_util.h" | 50 #include "chrome/installer/setup/setup_util.h" |
51 #include "chrome/installer/setup/uninstall.h" | 51 #include "chrome/installer/setup/uninstall.h" |
52 #include "chrome/installer/util/browser_distribution.h" | 52 #include "chrome/installer/util/browser_distribution.h" |
53 #include "chrome/installer/util/delete_after_reboot_helper.h" | 53 #include "chrome/installer/util/delete_after_reboot_helper.h" |
| 54 #include "chrome/installer/util/delete_old_versions.h" |
54 #include "chrome/installer/util/delete_tree_work_item.h" | 55 #include "chrome/installer/util/delete_tree_work_item.h" |
55 #include "chrome/installer/util/google_update_constants.h" | 56 #include "chrome/installer/util/google_update_constants.h" |
56 #include "chrome/installer/util/google_update_settings.h" | 57 #include "chrome/installer/util/google_update_settings.h" |
57 #include "chrome/installer/util/google_update_util.h" | 58 #include "chrome/installer/util/google_update_util.h" |
58 #include "chrome/installer/util/helper.h" | 59 #include "chrome/installer/util/helper.h" |
59 #include "chrome/installer/util/html_dialog.h" | 60 #include "chrome/installer/util/html_dialog.h" |
60 #include "chrome/installer/util/install_util.h" | 61 #include "chrome/installer/util/install_util.h" |
61 #include "chrome/installer/util/installation_state.h" | 62 #include "chrome/installer/util/installation_state.h" |
62 #include "chrome/installer/util/installation_validator.h" | 63 #include "chrome/installer/util/installation_validator.h" |
63 #include "chrome/installer/util/installer_state.h" | 64 #include "chrome/installer/util/installer_state.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 << BrowserDistribution::GetSpecificDistribution(type)-> | 317 << BrowserDistribution::GetSpecificDistribution(type)-> |
317 GetDisplayName(); | 318 GetDisplayName(); |
318 } | 319 } |
319 } | 320 } |
320 } | 321 } |
321 } | 322 } |
322 } | 323 } |
323 | 324 |
324 // This function is called when --rename-chrome-exe option is specified on | 325 // This function is called when --rename-chrome-exe option is specified on |
325 // setup.exe command line. This function assumes an in-use update has happened | 326 // setup.exe command line. This function assumes an in-use update has happened |
326 // for Chrome so there should be a file called new_chrome.exe on the file | 327 // for Chrome so there should be a file called new_chrome.exe on the file system |
327 // system and a key called 'opv' in the registry. This function will move | 328 // and a key called 'opv' in the registry. This function will move |
328 // new_chrome.exe to chrome.exe and delete 'opv' key in one atomic operation. | 329 // new_chrome.exe to chrome.exe and delete 'opv' key in one atomic operation. |
329 // This function also deletes elevation policies associated with the old version | 330 // This function also takes care of deleting files and elevation policies that |
330 // if they exist. | 331 // belong to old versions of Chrome. |
331 installer::InstallStatus RenameChromeExecutables( | 332 installer::InstallStatus RenameChromeExecutables( |
332 const InstallationState& original_state, | 333 const InstallationState& original_state, |
333 InstallerState* installer_state) { | 334 InstallerState* installer_state) { |
334 // See what products are already installed in multi mode. When we do the | 335 // See what products are already installed in multi mode. When we do the |
335 // rename for multi installs, we must update all installations since they | 336 // rename for multi installs, we must update all installations since they |
336 // share the binaries. | 337 // share the binaries. |
337 AddExistingMultiInstalls(original_state, installer_state); | 338 AddExistingMultiInstalls(original_state, installer_state); |
338 const base::FilePath &target_path = installer_state->target_path(); | 339 const base::FilePath &target_path = installer_state->target_path(); |
339 base::FilePath chrome_exe(target_path.Append(installer::kChromeExe)); | 340 base::FilePath chrome_exe(target_path.Append(installer::kChromeExe)); |
340 base::FilePath chrome_new_exe(target_path.Append(installer::kChromeNewExe)); | 341 base::FilePath chrome_new_exe(target_path.Append(installer::kChromeNewExe)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 install_list->AddDeleteRegValueWorkItem( | 381 install_list->AddDeleteRegValueWorkItem( |
381 reg_root, | 382 reg_root, |
382 version_key, | 383 version_key, |
383 KEY_WOW64_32KEY, | 384 KEY_WOW64_32KEY, |
384 google_update::kRegCriticalVersionField); | 385 google_update::kRegCriticalVersionField); |
385 install_list->AddDeleteRegValueWorkItem(reg_root, | 386 install_list->AddDeleteRegValueWorkItem(reg_root, |
386 version_key, | 387 version_key, |
387 KEY_WOW64_32KEY, | 388 KEY_WOW64_32KEY, |
388 google_update::kRegRenameCmdField); | 389 google_update::kRegRenameCmdField); |
389 } | 390 } |
| 391 |
| 392 // Delete old versions. |
| 393 AddDeleteOldVersionsWorkItem(*installer_state, install_list.get()); |
| 394 |
390 installer::InstallStatus ret = installer::RENAME_SUCCESSFUL; | 395 installer::InstallStatus ret = installer::RENAME_SUCCESSFUL; |
391 if (!install_list->Do()) { | 396 if (!install_list->Do()) { |
392 LOG(ERROR) << "Renaming of executables failed. Rolling back any changes."; | 397 LOG(ERROR) << "Renaming of executables failed. Rolling back any changes."; |
393 install_list->Rollback(); | 398 install_list->Rollback(); |
394 ret = installer::RENAME_FAILED; | 399 ret = installer::RENAME_FAILED; |
395 } | 400 } |
396 // temp_path's dtor will take care of deleting or scheduling itself for | 401 // temp_path's dtor will take care of deleting or scheduling itself for |
397 // deletion at reboot when this scope closes. | 402 // deletion at reboot when this scope closes. |
398 VLOG(1) << "Deleting temporary directory " << temp_path.path().value(); | 403 VLOG(1) << "Deleting temporary directory " << temp_path.path().value(); |
399 | 404 |
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 // to pass through, since this is only returned on uninstall which is | 1790 // to pass through, since this is only returned on uninstall which is |
1786 // never invoked directly by Google Update. | 1791 // never invoked directly by Google Update. |
1787 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1792 return_code = InstallUtil::GetInstallReturnCode(install_status); |
1788 } | 1793 } |
1789 | 1794 |
1790 installer::EndPersistentHistogramStorage(installer_state.target_path()); | 1795 installer::EndPersistentHistogramStorage(installer_state.target_path()); |
1791 VLOG(1) << "Installation complete, returning: " << return_code; | 1796 VLOG(1) << "Installation complete, returning: " << return_code; |
1792 | 1797 |
1793 return return_code; | 1798 return return_code; |
1794 } | 1799 } |
OLD | NEW |