| 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // Move chrome.exe to old_chrome.exe, then move new_chrome.exe to chrome.exe. | 371 // Move chrome.exe to old_chrome.exe, then move new_chrome.exe to chrome.exe. |
| 372 install_list->AddMoveTreeWorkItem(chrome_exe.value(), | 372 install_list->AddMoveTreeWorkItem(chrome_exe.value(), |
| 373 chrome_old_exe.value(), | 373 chrome_old_exe.value(), |
| 374 temp_path.path().value(), | 374 temp_path.path().value(), |
| 375 WorkItem::ALWAYS_MOVE); | 375 WorkItem::ALWAYS_MOVE); |
| 376 install_list->AddMoveTreeWorkItem(chrome_new_exe.value(), | 376 install_list->AddMoveTreeWorkItem(chrome_new_exe.value(), |
| 377 chrome_exe.value(), | 377 chrome_exe.value(), |
| 378 temp_path.path().value(), | 378 temp_path.path().value(), |
| 379 WorkItem::ALWAYS_MOVE); | 379 WorkItem::ALWAYS_MOVE); |
| 380 install_list->AddDeleteTreeWorkItem(chrome_new_exe, temp_path.path()); | 380 install_list->AddDeleteTreeWorkItem(chrome_new_exe, temp_path.path()); |
| 381 // old_chrome.exe is still in use in most cases, so ignore failures here. | |
| 382 install_list->AddDeleteTreeWorkItem(chrome_old_exe, temp_path.path())-> | |
| 383 set_ignore_failure(true); | |
| 384 | 381 |
| 385 // Add work items to delete the "opv", "cpv", and "cmd" values from all | 382 // Add work items to delete the "opv", "cpv", and "cmd" values from all |
| 386 // products we're operating on (which including the multi-install binaries). | 383 // products we're operating on (which including the multi-install binaries). |
| 387 const Products& products = installer_state->products(); | 384 const Products& products = installer_state->products(); |
| 388 HKEY reg_root = installer_state->root_key(); | 385 HKEY reg_root = installer_state->root_key(); |
| 389 base::string16 version_key; | 386 base::string16 version_key; |
| 390 for (Products::const_iterator it = products.begin(); it < products.end(); | 387 for (Products::const_iterator it = products.begin(); it < products.end(); |
| 391 ++it) { | 388 ++it) { |
| 392 version_key = (*it)->distribution()->GetVersionKey(); | 389 version_key = (*it)->distribution()->GetVersionKey(); |
| 393 install_list->AddDeleteRegValueWorkItem(reg_root, | 390 install_list->AddDeleteRegValueWorkItem(reg_root, |
| 394 version_key, | 391 version_key, |
| 395 KEY_WOW64_32KEY, | 392 KEY_WOW64_32KEY, |
| 396 google_update::kRegOldVersionField); | 393 google_update::kRegOldVersionField); |
| 397 install_list->AddDeleteRegValueWorkItem( | 394 install_list->AddDeleteRegValueWorkItem( |
| 398 reg_root, | 395 reg_root, |
| 399 version_key, | 396 version_key, |
| 400 KEY_WOW64_32KEY, | 397 KEY_WOW64_32KEY, |
| 401 google_update::kRegCriticalVersionField); | 398 google_update::kRegCriticalVersionField); |
| 402 install_list->AddDeleteRegValueWorkItem(reg_root, | 399 install_list->AddDeleteRegValueWorkItem(reg_root, |
| 403 version_key, | 400 version_key, |
| 404 KEY_WOW64_32KEY, | 401 KEY_WOW64_32KEY, |
| 405 google_update::kRegRenameCmdField); | 402 google_update::kRegRenameCmdField); |
| 406 } | 403 } |
| 404 // old_chrome.exe is still in use in most cases, so ignore failures here. |
| 405 // Make sure this is the last item in the list because it cannot be rolled |
| 406 // back. |
| 407 install_list->AddDeleteTreeWorkItem(chrome_old_exe, temp_path.path())-> |
| 408 set_ignore_failure(true); |
| 409 |
| 407 installer::InstallStatus ret = installer::RENAME_SUCCESSFUL; | 410 installer::InstallStatus ret = installer::RENAME_SUCCESSFUL; |
| 408 if (!install_list->Do()) { | 411 if (!install_list->Do()) { |
| 409 LOG(ERROR) << "Renaming of executables failed. Rolling back any changes."; | 412 LOG(ERROR) << "Renaming of executables failed. Rolling back any changes."; |
| 410 install_list->Rollback(); | 413 install_list->Rollback(); |
| 411 ret = installer::RENAME_FAILED; | 414 ret = installer::RENAME_FAILED; |
| 412 } | 415 } |
| 413 // temp_path's dtor will take care of deleting or scheduling itself for | 416 // temp_path's dtor will take care of deleting or scheduling itself for |
| 414 // deletion at reboot when this scope closes. | 417 // deletion at reboot when this scope closes. |
| 415 VLOG(1) << "Deleting temporary directory " << temp_path.path().value(); | 418 VLOG(1) << "Deleting temporary directory " << temp_path.path().value(); |
| 416 | 419 |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 // to pass through, since this is only returned on uninstall which is | 1808 // to pass through, since this is only returned on uninstall which is |
| 1806 // never invoked directly by Google Update. | 1809 // never invoked directly by Google Update. |
| 1807 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1810 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1808 } | 1811 } |
| 1809 | 1812 |
| 1810 installer::EndPersistentHistogramStorage(installer_state.target_path()); | 1813 installer::EndPersistentHistogramStorage(installer_state.target_path()); |
| 1811 VLOG(1) << "Installation complete, returning: " << return_code; | 1814 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1812 | 1815 |
| 1813 return return_code; | 1816 return return_code; |
| 1814 } | 1817 } |
| OLD | NEW |