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

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

Issue 869153004: Support migrating multi-install Chrome to single-install. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: verifier fix Created 5 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
« no previous file with comments | « no previous file | chrome/installer/setup/setup_main.cc » ('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 // 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 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 } 967 }
968 install_list->AddDeleteRegValueWorkItem( 968 install_list->AddDeleteRegValueWorkItem(
969 root_key, 969 root_key,
970 dist->GetStateKey(), 970 dist->GetStateKey(),
971 KEY_WOW64_32KEY, 971 KEY_WOW64_32KEY,
972 google_update::kRegUsageStatsField); 972 google_update::kRegUsageStatsField);
973 } 973 }
974 } 974 }
975 } 975 }
976 976
977 // Migrates the usagestats value from the binaries to Chrome when migrating
978 // multi-install Chrome to single-install.
979 void AddMigrateUsageStatesWorkItems(const InstallationState& original_state,
980 const InstallerState& installer_state,
981 WorkItemList* install_list) {
982 // Ensure that a non-multi install or update is being processed (i.e.,
983 // no "--multi-install" on the command line).
984 if (installer_state.is_multi_install())
985 return;
986
987 // Ensure that Chrome is the product being installed or updated (there are no
988 // other products, so it is especially unexpected for this to fail).
989 const Product* chrome_product =
990 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
991 if (!chrome_product) {
992 LOG(DFATAL) << "Not operating on Chrome while migrating to single-install.";
993 return;
994 }
995
996 const ProductState* chrome_state = original_state.GetProductState(
997 installer_state.system_install(),
998 BrowserDistribution::CHROME_BROWSER);
999 // Bail out if there is not an existing multi-install Chrome that is being
1000 // updated.
1001 if (!chrome_state || !chrome_state->is_multi_install()) {
1002 VLOG(1) << "No multi-install Chrome found to migrate to single-install.";
1003 return;
1004 }
1005
1006 const ProductState* binaries_state = original_state.GetProductState(
1007 installer_state.system_install(),
1008 BrowserDistribution::CHROME_BINARIES);
1009
1010 // There is nothing to be done if the binaries do not have stats.
1011 DWORD usagestats = 0;
1012 if (!binaries_state || !binaries_state->GetUsageStats(&usagestats)) {
1013 VLOG(1) << "No usagestats value found to migrate to single-install.";
1014 return;
1015 }
1016
1017 VLOG(1) << "Migrating usagestats value from multi-install to single-install.";
1018
1019 // Write the value that was read to Chrome's ClientState key.
1020 install_list->AddSetRegValueWorkItem(
1021 installer_state.root_key(),
1022 chrome_product->distribution()->GetStateKey(),
1023 KEY_WOW64_32KEY,
1024 google_update::kRegUsageStatsField,
1025 usagestats,
1026 true);
1027 }
1028
977 bool AppendPostInstallTasks(const InstallerState& installer_state, 1029 bool AppendPostInstallTasks(const InstallerState& installer_state,
978 const base::FilePath& setup_path, 1030 const base::FilePath& setup_path,
979 const Version* current_version, 1031 const Version* current_version,
980 const Version& new_version, 1032 const Version& new_version,
981 const base::FilePath& temp_path, 1033 const base::FilePath& temp_path,
982 WorkItemList* post_install_task_list) { 1034 WorkItemList* post_install_task_list) {
983 DCHECK(post_install_task_list); 1035 DCHECK(post_install_task_list);
984 1036
985 HKEY root = installer_state.root_key(); 1037 HKEY root = installer_state.root_key();
986 const Products& products = installer_state.products(); 1038 const Products& products = installer_state.products();
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 add_language_identifier, 1234 add_language_identifier,
1183 install_list); 1235 install_list);
1184 1236
1185 AddDelegateExecuteWorkItems(installer_state, target_path, new_version, 1237 AddDelegateExecuteWorkItems(installer_state, target_path, new_version,
1186 product, install_list); 1238 product, install_list);
1187 1239
1188 AddActiveSetupWorkItems(installer_state, setup_path, new_version, product, 1240 AddActiveSetupWorkItems(installer_state, setup_path, new_version, product,
1189 install_list); 1241 install_list);
1190 } 1242 }
1191 1243
1244 // Ensure that the Clients key for the binaries is gone for single installs.
1245 if (!installer_state.is_multi_install()) {
1246 BrowserDistribution* binaries_dist =
1247 BrowserDistribution::GetSpecificDistribution(
1248 BrowserDistribution::CHROME_BINARIES);
1249 install_list->AddDeleteRegKeyWorkItem(root,
1250 binaries_dist->GetVersionKey(),
1251 KEY_WOW64_32KEY);
1252 }
1253
1192 #if defined(GOOGLE_CHROME_BUILD) 1254 #if defined(GOOGLE_CHROME_BUILD)
1193 if (!InstallUtil::IsChromeSxSProcess()) 1255 if (!InstallUtil::IsChromeSxSProcess())
1194 AddRemoveLegacyAppCommandsWorkItems(installer_state, install_list); 1256 AddRemoveLegacyAppCommandsWorkItems(installer_state, install_list);
1195 #endif // GOOGLE_CHROME_BUILD 1257 #endif // GOOGLE_CHROME_BUILD
1196 1258
1197 // Add any remaining work items that involve special settings for 1259 // Add any remaining work items that involve special settings for
1198 // each product. 1260 // each product.
1199 AddProductSpecificWorkItems(original_state, 1261 AddProductSpecificWorkItems(original_state,
1200 installer_state, 1262 installer_state,
1201 setup_path, 1263 setup_path,
1202 new_version, 1264 new_version,
1203 current_version == NULL, 1265 current_version == NULL,
1204 add_language_identifier, 1266 add_language_identifier,
1205 install_list); 1267 install_list);
1206 1268
1207 // Copy over brand, usagestats, and other values. 1269 // Copy over brand, usagestats, and other values.
1208 AddGoogleUpdateWorkItems(original_state, installer_state, install_list); 1270 AddGoogleUpdateWorkItems(original_state, installer_state, install_list);
1209 1271
1272 // Migrate usagestats back to Chrome.
1273 AddMigrateUsageStatesWorkItems(original_state, installer_state, install_list);
1274
1210 // Append the tasks that run after the installation. 1275 // Append the tasks that run after the installation.
1211 AppendPostInstallTasks(installer_state, 1276 AppendPostInstallTasks(installer_state,
1212 setup_path, 1277 setup_path,
1213 current_version, 1278 current_version,
1214 new_version, 1279 new_version,
1215 temp_path, 1280 temp_path,
1216 install_list); 1281 install_list);
1217 } 1282 }
1218 1283
1219 void AddRegisterComDllWorkItems(const base::FilePath& dll_folder, 1284 void AddRegisterComDllWorkItems(const base::FilePath& dll_folder,
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 // Unconditionally remove the legacy Quick Enable command from the binaries. 1555 // Unconditionally remove the legacy Quick Enable command from the binaries.
1491 // Do this even if multi-install Chrome isn't installed to ensure that it is 1556 // Do this even if multi-install Chrome isn't installed to ensure that it is
1492 // not left behind in any case. 1557 // not left behind in any case.
1493 work_item_list->AddDeleteRegKeyWorkItem( 1558 work_item_list->AddDeleteRegKeyWorkItem(
1494 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) 1559 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY)
1495 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + 1560 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) +
1496 " command"); 1561 " command");
1497 } 1562 }
1498 1563
1499 } // namespace installer 1564 } // namespace installer
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698