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

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

Issue 1878313003: Convert //chrome/installer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert decompress.cc in mini_installer. Created 4 years, 8 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>
11 #include <shlobj.h> 11 #include <shlobj.h>
12 #include <stddef.h> 12 #include <stddef.h>
13 #include <stdint.h> 13 #include <stdint.h>
14 #include <time.h> 14 #include <time.h>
15 15
16 #include <memory>
16 #include <vector> 17 #include <vector>
17 18
18 #include "base/bind.h" 19 #include "base/bind.h"
19 #include "base/command_line.h" 20 #include "base/command_line.h"
20 #include "base/files/file_path.h" 21 #include "base/files/file_path.h"
21 #include "base/files/file_util.h" 22 #include "base/files/file_util.h"
22 #include "base/logging.h" 23 #include "base/logging.h"
23 #include "base/macros.h" 24 #include "base/macros.h"
24 #include "base/memory/scoped_ptr.h"
25 #include "base/path_service.h" 25 #include "base/path_service.h"
26 #include "base/strings/string_util.h" 26 #include "base/strings/string_util.h"
27 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
28 #include "base/version.h" 28 #include "base/version.h"
29 #include "base/win/registry.h" 29 #include "base/win/registry.h"
30 #include "base/win/windows_version.h" 30 #include "base/win/windows_version.h"
31 #include "chrome/common/chrome_constants.h" 31 #include "chrome/common/chrome_constants.h"
32 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
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"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // case. 183 // case.
184 bool AddFirewallRulesCallback(bool system_level, 184 bool AddFirewallRulesCallback(bool system_level,
185 BrowserDistribution* dist, 185 BrowserDistribution* dist,
186 const base::FilePath& chrome_path, 186 const base::FilePath& chrome_path,
187 bool remove_on_rollback, 187 bool remove_on_rollback,
188 const CallbackWorkItem& work_item) { 188 const CallbackWorkItem& work_item) {
189 // There is no work to do on rollback if this is not a new install. 189 // There is no work to do on rollback if this is not a new install.
190 if (work_item.IsRollback() && !remove_on_rollback) 190 if (work_item.IsRollback() && !remove_on_rollback)
191 return true; 191 return true;
192 192
193 scoped_ptr<FirewallManager> manager = 193 std::unique_ptr<FirewallManager> manager =
194 FirewallManager::Create(dist, chrome_path); 194 FirewallManager::Create(dist, chrome_path);
195 if (!manager) { 195 if (!manager) {
196 LOG(ERROR) << "Failed creating a FirewallManager. Continuing with install."; 196 LOG(ERROR) << "Failed creating a FirewallManager. Continuing with install.";
197 return true; 197 return true;
198 } 198 }
199 199
200 if (work_item.IsRollback()) { 200 if (work_item.IsRollback()) {
201 manager->RemoveFirewallRules(); 201 manager->RemoveFirewallRules();
202 return true; 202 return true;
203 } 203 }
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 HKEY root = installer_state.root_key(); 898 HKEY root = installer_state.root_key();
899 const Products& products = installer_state.products(); 899 const Products& products = installer_state.products();
900 base::FilePath new_chrome_exe( 900 base::FilePath new_chrome_exe(
901 installer_state.target_path().Append(installer::kChromeNewExe)); 901 installer_state.target_path().Append(installer::kChromeNewExe));
902 902
903 // Append work items that will only be executed if this was an update. 903 // Append work items that will only be executed if this was an update.
904 // We update the 'opv' value with the current version that is active, 904 // We update the 'opv' value with the current version that is active,
905 // the 'cpv' value with the critical update version (if present), and the 905 // the 'cpv' value with the critical update version (if present), and the
906 // 'cmd' value with the rename command to run. 906 // 'cmd' value with the rename command to run.
907 { 907 {
908 scoped_ptr<WorkItemList> in_use_update_work_items( 908 std::unique_ptr<WorkItemList> in_use_update_work_items(
909 WorkItem::CreateConditionalWorkItemList( 909 WorkItem::CreateConditionalWorkItemList(
910 new ConditionRunIfFileExists(new_chrome_exe))); 910 new ConditionRunIfFileExists(new_chrome_exe)));
911 in_use_update_work_items->set_log_message("InUseUpdateWorkItemList"); 911 in_use_update_work_items->set_log_message("InUseUpdateWorkItemList");
912 912
913 // |critical_version| will be valid only if this in-use update includes a 913 // |critical_version| will be valid only if this in-use update includes a
914 // version considered critical relative to the version being updated. 914 // version considered critical relative to the version being updated.
915 Version critical_version(installer_state.DetermineCriticalVersion( 915 Version critical_version(installer_state.DetermineCriticalVersion(
916 current_version, new_version)); 916 current_version, new_version));
917 base::FilePath installer_path( 917 base::FilePath installer_path(
918 installer_state.GetInstallerDirectory(new_version).Append( 918 installer_state.GetInstallerDirectory(new_version).Append(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 product_rename_cmd.GetCommandLineString(), 972 product_rename_cmd.GetCommandLineString(),
973 true); 973 true);
974 } 974 }
975 } 975 }
976 976
977 post_install_task_list->AddWorkItem(in_use_update_work_items.release()); 977 post_install_task_list->AddWorkItem(in_use_update_work_items.release());
978 } 978 }
979 979
980 // Append work items that will be executed if this was NOT an in-use update. 980 // Append work items that will be executed if this was NOT an in-use update.
981 { 981 {
982 scoped_ptr<WorkItemList> regular_update_work_items( 982 std::unique_ptr<WorkItemList> regular_update_work_items(
983 WorkItem::CreateConditionalWorkItemList( 983 WorkItem::CreateConditionalWorkItemList(
984 new Not(new ConditionRunIfFileExists(new_chrome_exe)))); 984 new Not(new ConditionRunIfFileExists(new_chrome_exe))));
985 regular_update_work_items->set_log_message("RegularUpdateWorkItemList"); 985 regular_update_work_items->set_log_message("RegularUpdateWorkItemList");
986 986
987 // Since this was not an in-use-update, delete 'opv', 'cpv', and 'cmd' keys. 987 // Since this was not an in-use-update, delete 'opv', 'cpv', and 'cmd' keys.
988 for (size_t i = 0; i < products.size(); ++i) { 988 for (size_t i = 0; i < products.size(); ++i) {
989 BrowserDistribution* dist = products[i]->distribution(); 989 BrowserDistribution* dist = products[i]->distribution();
990 base::string16 version_key(dist->GetVersionKey()); 990 base::string16 version_key(dist->GetVersionKey());
991 regular_update_work_items->AddDeleteRegValueWorkItem( 991 regular_update_work_items->AddDeleteRegValueWorkItem(
992 root, 992 root,
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 // Unconditionally remove the legacy Quick Enable command from the binaries. 1354 // 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 1355 // Do this even if multi-install Chrome isn't installed to ensure that it is
1356 // not left behind in any case. 1356 // not left behind in any case.
1357 work_item_list->AddDeleteRegKeyWorkItem( 1357 work_item_list->AddDeleteRegKeyWorkItem(
1358 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) 1358 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY)
1359 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + 1359 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) +
1360 " command"); 1360 " command");
1361 } 1361 }
1362 1362
1363 } // namespace installer 1363 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_unittest.cc ('k') | chrome/installer/setup/install_worker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698