| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 // Move chrome.exe to old_chrome.exe, then move new_chrome.exe to chrome.exe. | 396 // Move chrome.exe to old_chrome.exe, then move new_chrome.exe to chrome.exe. |
| 397 install_list->AddMoveTreeWorkItem(chrome_exe.value(), | 397 install_list->AddMoveTreeWorkItem(chrome_exe.value(), |
| 398 chrome_old_exe.value(), | 398 chrome_old_exe.value(), |
| 399 temp_path.path().value(), | 399 temp_path.path().value(), |
| 400 WorkItem::ALWAYS_MOVE); | 400 WorkItem::ALWAYS_MOVE); |
| 401 install_list->AddMoveTreeWorkItem(chrome_new_exe.value(), | 401 install_list->AddMoveTreeWorkItem(chrome_new_exe.value(), |
| 402 chrome_exe.value(), | 402 chrome_exe.value(), |
| 403 temp_path.path().value(), | 403 temp_path.path().value(), |
| 404 WorkItem::ALWAYS_MOVE); | 404 WorkItem::ALWAYS_MOVE); |
| 405 install_list->AddDeleteTreeWorkItem(chrome_new_exe, temp_path.path()); | 405 install_list->AddDeleteTreeWorkItem(chrome_new_exe, temp_path.path()); |
| 406 // old_chrome.exe is still in use in most cases, so ignore failures here. | |
| 407 install_list->AddDeleteTreeWorkItem(chrome_old_exe, temp_path.path())-> | |
| 408 set_ignore_failure(true); | |
| 409 | 406 |
| 410 // Add work items to delete the "opv", "cpv", and "cmd" values from all | 407 // Add work items to delete the "opv", "cpv", and "cmd" values from all |
| 411 // products we're operating on (which including the multi-install binaries). | 408 // products we're operating on (which including the multi-install binaries). |
| 412 const Products& products = installer_state->products(); | 409 const Products& products = installer_state->products(); |
| 413 HKEY reg_root = installer_state->root_key(); | 410 HKEY reg_root = installer_state->root_key(); |
| 414 base::string16 version_key; | 411 base::string16 version_key; |
| 415 for (Products::const_iterator it = products.begin(); it < products.end(); | 412 for (Products::const_iterator it = products.begin(); it < products.end(); |
| 416 ++it) { | 413 ++it) { |
| 417 version_key = (*it)->distribution()->GetVersionKey(); | 414 version_key = (*it)->distribution()->GetVersionKey(); |
| 418 install_list->AddDeleteRegValueWorkItem(reg_root, | 415 install_list->AddDeleteRegValueWorkItem(reg_root, |
| 419 version_key, | 416 version_key, |
| 420 KEY_WOW64_32KEY, | 417 KEY_WOW64_32KEY, |
| 421 google_update::kRegOldVersionField); | 418 google_update::kRegOldVersionField); |
| 422 install_list->AddDeleteRegValueWorkItem( | 419 install_list->AddDeleteRegValueWorkItem( |
| 423 reg_root, | 420 reg_root, |
| 424 version_key, | 421 version_key, |
| 425 KEY_WOW64_32KEY, | 422 KEY_WOW64_32KEY, |
| 426 google_update::kRegCriticalVersionField); | 423 google_update::kRegCriticalVersionField); |
| 427 install_list->AddDeleteRegValueWorkItem(reg_root, | 424 install_list->AddDeleteRegValueWorkItem(reg_root, |
| 428 version_key, | 425 version_key, |
| 429 KEY_WOW64_32KEY, | 426 KEY_WOW64_32KEY, |
| 430 google_update::kRegRenameCmdField); | 427 google_update::kRegRenameCmdField); |
| 431 } | 428 } |
| 429 // old_chrome.exe is still in use in most cases, so ignore failures here. |
| 430 // Make sure this is the last item in the list because it cannot be rolled |
| 431 // back. |
| 432 install_list->AddDeleteTreeWorkItem(chrome_old_exe, temp_path.path())-> |
| 433 set_ignore_failure(true); |
| 434 |
| 432 installer::InstallStatus ret = installer::RENAME_SUCCESSFUL; | 435 installer::InstallStatus ret = installer::RENAME_SUCCESSFUL; |
| 433 if (!install_list->Do()) { | 436 if (!install_list->Do()) { |
| 434 LOG(ERROR) << "Renaming of executables failed. Rolling back any changes."; | 437 LOG(ERROR) << "Renaming of executables failed. Rolling back any changes."; |
| 435 install_list->Rollback(); | 438 install_list->Rollback(); |
| 436 ret = installer::RENAME_FAILED; | 439 ret = installer::RENAME_FAILED; |
| 437 } | 440 } |
| 438 // temp_path's dtor will take care of deleting or scheduling itself for | 441 // temp_path's dtor will take care of deleting or scheduling itself for |
| 439 // deletion at reboot when this scope closes. | 442 // deletion at reboot when this scope closes. |
| 440 VLOG(1) << "Deleting temporary directory " << temp_path.path().value(); | 443 VLOG(1) << "Deleting temporary directory " << temp_path.path().value(); |
| 441 | 444 |
| (...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1844 // to pass through, since this is only returned on uninstall which is | 1847 // to pass through, since this is only returned on uninstall which is |
| 1845 // never invoked directly by Google Update. | 1848 // never invoked directly by Google Update. |
| 1846 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1849 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1847 } | 1850 } |
| 1848 | 1851 |
| 1849 installer::EndPersistentHistogramStorage(installer_state.target_path()); | 1852 installer::EndPersistentHistogramStorage(installer_state.target_path()); |
| 1850 VLOG(1) << "Installation complete, returning: " << return_code; | 1853 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1851 | 1854 |
| 1852 return return_code; | 1855 return return_code; |
| 1853 } | 1856 } |
| OLD | NEW |