Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: chrome/installer/setup/setup_main.cc

Issue 1764053002: Revert of Delete old files after an update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/installer/setup/install_worker.cc ('k') | chrome/installer/util/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"
55 #include "chrome/installer/util/delete_tree_work_item.h" 54 #include "chrome/installer/util/delete_tree_work_item.h"
56 #include "chrome/installer/util/google_update_constants.h" 55 #include "chrome/installer/util/google_update_constants.h"
57 #include "chrome/installer/util/google_update_settings.h" 56 #include "chrome/installer/util/google_update_settings.h"
58 #include "chrome/installer/util/google_update_util.h" 57 #include "chrome/installer/util/google_update_util.h"
59 #include "chrome/installer/util/helper.h" 58 #include "chrome/installer/util/helper.h"
60 #include "chrome/installer/util/html_dialog.h" 59 #include "chrome/installer/util/html_dialog.h"
61 #include "chrome/installer/util/install_util.h" 60 #include "chrome/installer/util/install_util.h"
62 #include "chrome/installer/util/installation_state.h" 61 #include "chrome/installer/util/installation_state.h"
63 #include "chrome/installer/util/installation_validator.h" 62 #include "chrome/installer/util/installation_validator.h"
64 #include "chrome/installer/util/installer_state.h" 63 #include "chrome/installer/util/installer_state.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 << BrowserDistribution::GetSpecificDistribution(type)-> 316 << BrowserDistribution::GetSpecificDistribution(type)->
318 GetDisplayName(); 317 GetDisplayName();
319 } 318 }
320 } 319 }
321 } 320 }
322 } 321 }
323 } 322 }
324 323
325 // This function is called when --rename-chrome-exe option is specified on 324 // This function is called when --rename-chrome-exe option is specified on
326 // setup.exe command line. This function assumes an in-use update has happened 325 // setup.exe command line. This function assumes an in-use update has happened
327 // for Chrome so there should be a file called new_chrome.exe on the file system 326 // for Chrome so there should be a file called new_chrome.exe on the file
328 // and a key called 'opv' in the registry. This function will move 327 // system and a key called 'opv' in the registry. This function will move
329 // new_chrome.exe to chrome.exe and delete 'opv' key in one atomic operation. 328 // new_chrome.exe to chrome.exe and delete 'opv' key in one atomic operation.
330 // This function also takes care of deleting files and elevation policies that 329 // This function also deletes elevation policies associated with the old version
331 // belong to old versions of Chrome. 330 // if they exist.
332 installer::InstallStatus RenameChromeExecutables( 331 installer::InstallStatus RenameChromeExecutables(
333 const InstallationState& original_state, 332 const InstallationState& original_state,
334 InstallerState* installer_state) { 333 InstallerState* installer_state) {
335 // See what products are already installed in multi mode. When we do the 334 // See what products are already installed in multi mode. When we do the
336 // rename for multi installs, we must update all installations since they 335 // rename for multi installs, we must update all installations since they
337 // share the binaries. 336 // share the binaries.
338 AddExistingMultiInstalls(original_state, installer_state); 337 AddExistingMultiInstalls(original_state, installer_state);
339 const base::FilePath &target_path = installer_state->target_path(); 338 const base::FilePath &target_path = installer_state->target_path();
340 base::FilePath chrome_exe(target_path.Append(installer::kChromeExe)); 339 base::FilePath chrome_exe(target_path.Append(installer::kChromeExe));
341 base::FilePath chrome_new_exe(target_path.Append(installer::kChromeNewExe)); 340 base::FilePath chrome_new_exe(target_path.Append(installer::kChromeNewExe));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 install_list->AddDeleteRegValueWorkItem( 380 install_list->AddDeleteRegValueWorkItem(
382 reg_root, 381 reg_root,
383 version_key, 382 version_key,
384 KEY_WOW64_32KEY, 383 KEY_WOW64_32KEY,
385 google_update::kRegCriticalVersionField); 384 google_update::kRegCriticalVersionField);
386 install_list->AddDeleteRegValueWorkItem(reg_root, 385 install_list->AddDeleteRegValueWorkItem(reg_root,
387 version_key, 386 version_key,
388 KEY_WOW64_32KEY, 387 KEY_WOW64_32KEY,
389 google_update::kRegRenameCmdField); 388 google_update::kRegRenameCmdField);
390 } 389 }
391
392 // Delete old versions.
393 AddDeleteOldVersionsWorkItem(*installer_state, install_list.get());
394
395 installer::InstallStatus ret = installer::RENAME_SUCCESSFUL; 390 installer::InstallStatus ret = installer::RENAME_SUCCESSFUL;
396 if (!install_list->Do()) { 391 if (!install_list->Do()) {
397 LOG(ERROR) << "Renaming of executables failed. Rolling back any changes."; 392 LOG(ERROR) << "Renaming of executables failed. Rolling back any changes.";
398 install_list->Rollback(); 393 install_list->Rollback();
399 ret = installer::RENAME_FAILED; 394 ret = installer::RENAME_FAILED;
400 } 395 }
401 // temp_path's dtor will take care of deleting or scheduling itself for 396 // temp_path's dtor will take care of deleting or scheduling itself for
402 // deletion at reboot when this scope closes. 397 // deletion at reboot when this scope closes.
403 VLOG(1) << "Deleting temporary directory " << temp_path.path().value(); 398 VLOG(1) << "Deleting temporary directory " << temp_path.path().value();
404 399
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 // to pass through, since this is only returned on uninstall which is 1785 // to pass through, since this is only returned on uninstall which is
1791 // never invoked directly by Google Update. 1786 // never invoked directly by Google Update.
1792 return_code = InstallUtil::GetInstallReturnCode(install_status); 1787 return_code = InstallUtil::GetInstallReturnCode(install_status);
1793 } 1788 }
1794 1789
1795 installer::EndPersistentHistogramStorage(installer_state.target_path()); 1790 installer::EndPersistentHistogramStorage(installer_state.target_path());
1796 VLOG(1) << "Installation complete, returning: " << return_code; 1791 VLOG(1) << "Installation complete, returning: " << return_code;
1797 1792
1798 return return_code; 1793 return return_code;
1799 } 1794 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_worker.cc ('k') | chrome/installer/util/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698