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

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: tweaks Created 5 years, 11 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 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 } 1085 }
1086 install_list->AddDeleteRegValueWorkItem( 1086 install_list->AddDeleteRegValueWorkItem(
1087 root_key, 1087 root_key,
1088 dist->GetStateKey(), 1088 dist->GetStateKey(),
1089 KEY_WOW64_32KEY, 1089 KEY_WOW64_32KEY,
1090 google_update::kRegUsageStatsField); 1090 google_update::kRegUsageStatsField);
1091 } 1091 }
1092 } 1092 }
1093 } 1093 }
1094 1094
1095 // Migrates the usagestats value from the binaries to Chrome when migrating
1096 // multi-install Chrome to single-install.
1097 void AddMigrateUsageStatesWorkItems(const InstallationState& original_state,
1098 const InstallerState& installer_state,
1099 WorkItemList* install_list) {
1100 // Ensure that a non-multi install or update is being processed (i.e.,
1101 // no "--multi-install" on the command line).
1102 if (installer_state.is_multi_install())
1103 return;
1104
1105 // Ensure that Chrome is the product being installed or updated (there are no
1106 // other products, so it is especially unexpected for this to fail).
1107 const Product* chrome_product =
1108 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
1109 if (!chrome_product) {
1110 NOTREACHED();
robertshield 2015/01/28 23:17:59 Is it worth logging this (and maybe other, but mos
grt (UTC plus 2) 2015/01/29 17:56:51 Excellent idea. Done.
1111 return;
1112 }
1113
1114 const ProductState* chrome_state = original_state.GetProductState(
1115 installer_state.system_install(),
1116 BrowserDistribution::CHROME_BROWSER);
1117 // Bail out if there is not an existing multi-install Chrome that is being
1118 // updated.
1119 if (!chrome_state || !chrome_state->is_multi_install())
1120 return;
1121
1122 const ProductState* binaries_state = original_state.GetProductState(
1123 installer_state.system_install(),
1124 BrowserDistribution::CHROME_BINARIES);
1125
1126 // There is nothing to be done if the binaries do not have stats.
1127 DWORD usagestats = 0;
1128 if (!binaries_state || !binaries_state->GetUsageStats(&usagestats))
1129 return;
1130
1131 // Write the value that was read to Chrome's ClientState key.
1132 install_list->AddSetRegValueWorkItem(
1133 installer_state.root_key(),
1134 chrome_product->distribution()->GetStateKey(),
1135 KEY_WOW64_32KEY,
1136 google_update::kRegUsageStatsField,
1137 usagestats,
1138 true);
1139 }
1140
1095 bool AppendPostInstallTasks(const InstallerState& installer_state, 1141 bool AppendPostInstallTasks(const InstallerState& installer_state,
1096 const base::FilePath& setup_path, 1142 const base::FilePath& setup_path,
1097 const Version* current_version, 1143 const Version* current_version,
1098 const Version& new_version, 1144 const Version& new_version,
1099 const base::FilePath& temp_path, 1145 const base::FilePath& temp_path,
1100 WorkItemList* post_install_task_list) { 1146 WorkItemList* post_install_task_list) {
1101 DCHECK(post_install_task_list); 1147 DCHECK(post_install_task_list);
1102 1148
1103 HKEY root = installer_state.root_key(); 1149 HKEY root = installer_state.root_key();
1104 const Products& products = installer_state.products(); 1150 const Products& products = installer_state.products();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 add_language_identifier, 1349 add_language_identifier,
1304 install_list); 1350 install_list);
1305 1351
1306 AddDelegateExecuteWorkItems(installer_state, target_path, new_version, 1352 AddDelegateExecuteWorkItems(installer_state, target_path, new_version,
1307 product, install_list); 1353 product, install_list);
1308 1354
1309 AddActiveSetupWorkItems(installer_state, setup_path, new_version, product, 1355 AddActiveSetupWorkItems(installer_state, setup_path, new_version, product,
1310 install_list); 1356 install_list);
1311 } 1357 }
1312 1358
1359 // Ensure that the Clients key for the binaries is gone for single installs.
1360 if (!installer_state.is_multi_install()) {
1361 BrowserDistribution* binaries_dist =
1362 BrowserDistribution::GetSpecificDistribution(
1363 BrowserDistribution::CHROME_BINARIES);
1364 install_list->AddDeleteRegKeyWorkItem(root,
1365 binaries_dist->GetVersionKey(),
1366 KEY_WOW64_32KEY);
1367 }
1368
1313 // TODO(huangs): Implement actual migration code and remove the hack below. 1369 // TODO(huangs): Implement actual migration code and remove the hack below.
1314 // If installing Chrome without the legacy stand-alone App Launcher (to be 1370 // If installing Chrome without the legacy stand-alone App Launcher (to be
1315 // handled later), add "shadow" App Launcher registry keys so Google Update 1371 // handled later), add "shadow" App Launcher registry keys so Google Update
1316 // would recognize the "dr" value in the App Launcher ClientState key. 1372 // would recognize the "dr" value in the App Launcher ClientState key.
1317 // Checking .is_multi_install() excludes Chrome Canary and stand-alone Chrome. 1373 // Checking .is_multi_install() excludes Chrome Canary and stand-alone Chrome.
1318 if (installer_state.is_multi_install() && 1374 if (installer_state.is_multi_install() &&
1319 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) && 1375 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) &&
1320 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { 1376 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) {
1321 BrowserDistribution* shadow_app_launcher_dist = 1377 BrowserDistribution* shadow_app_launcher_dist =
1322 BrowserDistribution::GetSpecificDistribution( 1378 BrowserDistribution::GetSpecificDistribution(
(...skipping 11 matching lines...) Expand all
1334 AddProductSpecificWorkItems(original_state, 1390 AddProductSpecificWorkItems(original_state,
1335 installer_state, 1391 installer_state,
1336 setup_path, 1392 setup_path,
1337 new_version, 1393 new_version,
1338 current_version == NULL, 1394 current_version == NULL,
1339 install_list); 1395 install_list);
1340 1396
1341 // Copy over brand, usagestats, and other values. 1397 // Copy over brand, usagestats, and other values.
1342 AddGoogleUpdateWorkItems(original_state, installer_state, install_list); 1398 AddGoogleUpdateWorkItems(original_state, installer_state, install_list);
1343 1399
1400 // Migrate usagestats back to Chrome.
1401 AddMigrateUsageStatesWorkItems(original_state, installer_state, install_list);
1402
1344 // Append the tasks that run after the installation. 1403 // Append the tasks that run after the installation.
1345 AppendPostInstallTasks(installer_state, 1404 AppendPostInstallTasks(installer_state,
1346 setup_path, 1405 setup_path,
1347 current_version, 1406 current_version,
1348 new_version, 1407 new_version,
1349 temp_path, 1408 temp_path,
1350 install_list); 1409 install_list);
1351 } 1410 }
1352 1411
1353 void AddRegisterComDllWorkItems(const base::FilePath& dll_folder, 1412 void AddRegisterComDllWorkItems(const base::FilePath& dll_folder,
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 // Unconditionally remove the legacy Quick Enable command from the binaries. 1710 // Unconditionally remove the legacy Quick Enable command from the binaries.
1652 // Do this even if multi-install Chrome isn't installed to ensure that it is 1711 // Do this even if multi-install Chrome isn't installed to ensure that it is
1653 // not left behind in any case. 1712 // not left behind in any case.
1654 work_item_list->AddDeleteRegKeyWorkItem( 1713 work_item_list->AddDeleteRegKeyWorkItem(
1655 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) 1714 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY)
1656 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + 1715 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) +
1657 " command"); 1716 " command");
1658 } 1717 }
1659 1718
1660 } // namespace installer 1719 } // namespace installer
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/setup/setup_main.cc » ('j') | chrome/installer/util/installation_validator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698