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/install_worker.cc

Issue 1666363002: Delete old files after an update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 // This file contains the definitions of the installer functions that build 5 // This file contains the definitions of the installer functions that build
6 // the WorkItemList used to install the application. 6 // the WorkItemList used to install the application.
7 7
8 #include "chrome/installer/setup/install_worker.h" 8 #include "chrome/installer/setup/install_worker.h"
9 9
10 #include <oaidl.h> 10 #include <oaidl.h>
(...skipping 22 matching lines...) Expand all
33 #include "chrome/installer/setup/app_launcher_installer.h" 33 #include "chrome/installer/setup/app_launcher_installer.h"
34 #include "chrome/installer/setup/install.h" 34 #include "chrome/installer/setup/install.h"
35 #include "chrome/installer/setup/setup_constants.h" 35 #include "chrome/installer/setup/setup_constants.h"
36 #include "chrome/installer/setup/setup_util.h" 36 #include "chrome/installer/setup/setup_util.h"
37 #include "chrome/installer/setup/update_active_setup_version_work_item.h" 37 #include "chrome/installer/setup/update_active_setup_version_work_item.h"
38 #include "chrome/installer/util/app_registration_data.h" 38 #include "chrome/installer/util/app_registration_data.h"
39 #include "chrome/installer/util/browser_distribution.h" 39 #include "chrome/installer/util/browser_distribution.h"
40 #include "chrome/installer/util/callback_work_item.h" 40 #include "chrome/installer/util/callback_work_item.h"
41 #include "chrome/installer/util/conditional_work_item_list.h" 41 #include "chrome/installer/util/conditional_work_item_list.h"
42 #include "chrome/installer/util/create_reg_key_work_item.h" 42 #include "chrome/installer/util/create_reg_key_work_item.h"
43 #include "chrome/installer/util/delete_old_versions.h"
43 #include "chrome/installer/util/firewall_manager_win.h" 44 #include "chrome/installer/util/firewall_manager_win.h"
44 #include "chrome/installer/util/google_update_constants.h" 45 #include "chrome/installer/util/google_update_constants.h"
45 #include "chrome/installer/util/helper.h" 46 #include "chrome/installer/util/helper.h"
46 #include "chrome/installer/util/install_util.h" 47 #include "chrome/installer/util/install_util.h"
47 #include "chrome/installer/util/installation_state.h" 48 #include "chrome/installer/util/installation_state.h"
48 #include "chrome/installer/util/installer_state.h" 49 #include "chrome/installer/util/installer_state.h"
49 #include "chrome/installer/util/l10n_string_util.h" 50 #include "chrome/installer/util/l10n_string_util.h"
50 #include "chrome/installer/util/product.h" 51 #include "chrome/installer/util/product.h"
51 #include "chrome/installer/util/set_reg_value_work_item.h" 52 #include "chrome/installer/util/set_reg_value_work_item.h"
52 #include "chrome/installer/util/shell_util.h" 53 #include "chrome/installer/util/shell_util.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 393
393 const HKEY root = installer_state.root_key(); 394 const HKEY root = installer_state.root_key();
394 base::string16 delegate_execute_path(L"Software\\Classes\\CLSID\\"); 395 base::string16 delegate_execute_path(L"Software\\Classes\\CLSID\\");
395 delegate_execute_path.append(handler_class_uuid); 396 delegate_execute_path.append(handler_class_uuid);
396 // Delete both 64 and 32 keys to handle 32->64 or 64->32 migration. 397 // Delete both 64 and 32 keys to handle 32->64 or 64->32 migration.
397 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path, KEY_WOW64_32KEY); 398 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path, KEY_WOW64_32KEY);
398 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path, KEY_WOW64_64KEY); 399 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path, KEY_WOW64_64KEY);
399 } 400 }
400 } 401 }
401 402
403 bool DeleteOldVersionsCallback(const base::FilePath& install_dir,
404 const CallbackWorkItem& work_item) {
405 // No rollback is possible for this action.
406 if (work_item.IsRollback())
407 return true;
408
409 DeleteOldVersions(install_dir);
410
411 // TODO(fdoray): Launch a cleanup process if old files remain.
412 // crbug.com/451546
413 return true;
414 }
415
402 } // namespace 416 } // namespace
403 417
404 // This method adds work items to create (or update) Chrome uninstall entry in 418 // This method adds work items to create (or update) Chrome uninstall entry in
405 // either the Control Panel->Add/Remove Programs list or in the Omaha client 419 // either the Control Panel->Add/Remove Programs list or in the Omaha client
406 // state key if running under an MSI installer. 420 // state key if running under an MSI installer.
407 void AddUninstallShortcutWorkItems(const InstallerState& installer_state, 421 void AddUninstallShortcutWorkItems(const InstallerState& installer_state,
408 const base::FilePath& setup_path, 422 const base::FilePath& setup_path,
409 const Version& new_version, 423 const Version& new_version,
410 const Product& product, 424 const Product& product,
411 WorkItemList* install_list) { 425 WorkItemList* install_list) {
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 regular_update_work_items->AddDeleteRegValueWorkItem( 1010 regular_update_work_items->AddDeleteRegValueWorkItem(
997 root, 1011 root,
998 version_key, 1012 version_key,
999 KEY_WOW64_32KEY, 1013 KEY_WOW64_32KEY,
1000 google_update::kRegCriticalVersionField); 1014 google_update::kRegCriticalVersionField);
1001 regular_update_work_items->AddDeleteRegValueWorkItem( 1015 regular_update_work_items->AddDeleteRegValueWorkItem(
1002 root, 1016 root,
1003 version_key, 1017 version_key,
1004 KEY_WOW64_32KEY, 1018 KEY_WOW64_32KEY,
1005 google_update::kRegRenameCmdField); 1019 google_update::kRegRenameCmdField);
1020
1021 // Delete old files.
1022 regular_update_work_items->AddCallbackWorkItem(base::Bind(
1023 &DeleteOldVersionsCallback, installer_state.target_path()));
fdoray 2016/02/05 22:56:41 Note to myself: I've just seen that InstallerStat
1006 } 1024 }
1007 1025
1008 post_install_task_list->AddWorkItem(regular_update_work_items.release()); 1026 post_install_task_list->AddWorkItem(regular_update_work_items.release());
1009 } 1027 }
1010 1028
1011 AddRegisterComDllWorkItemsForPackage(installer_state, current_version, 1029 AddRegisterComDllWorkItemsForPackage(installer_state, current_version,
1012 new_version, post_install_task_list); 1030 new_version, post_install_task_list);
1013 1031
1014 // If we're told that we're an MSI install, make sure to set the marker 1032 // If we're told that we're an MSI install, make sure to set the marker
1015 // in the client state key so that future updates do the right thing. 1033 // in the client state key so that future updates do the right thing.
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 // Unconditionally remove the legacy Quick Enable command from the binaries. 1372 // Unconditionally remove the legacy Quick Enable command from the binaries.
1355 // Do this even if multi-install Chrome isn't installed to ensure that it is 1373 // Do this even if multi-install Chrome isn't installed to ensure that it is
1356 // not left behind in any case. 1374 // not left behind in any case.
1357 work_item_list->AddDeleteRegKeyWorkItem( 1375 work_item_list->AddDeleteRegKeyWorkItem(
1358 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) 1376 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY)
1359 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + 1377 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) +
1360 " command"); 1378 " command");
1361 } 1379 }
1362 1380
1363 } // namespace installer 1381 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698