Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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. | |
|
robertshield
2015/01/23 22:45:30
any reason not to do this separately first, or doe
grt (UTC plus 2)
2015/01/24 02:25:16
In the current world, usagestats is read from/writ
| |
| 1097 void AddMigrateUsageStatesWorkItems(const InstallationState& original_state, | |
| 1098 const InstallerState& installer_state, | |
| 1099 WorkItemList* install_list) { | |
| 1100 // This operation only applies to single-installs. | |
|
robertshield
2015/01/23 22:45:30
nit: less ambiguous: This operation only applies w
grt (UTC plus 2)
2015/01/24 02:25:15
Reworded all comments here in the hopes that they
| |
| 1101 if (installer_state.is_multi_install()) | |
| 1102 return; | |
| 1103 | |
| 1104 // This operation only applies to Chrome. | |
| 1105 const Product* chrome_product = | |
| 1106 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER); | |
| 1107 if (!chrome_product) { | |
| 1108 NOTREACHED(); | |
| 1109 return; | |
| 1110 } | |
| 1111 | |
| 1112 const ProductState* chrome_state = original_state.GetProductState( | |
| 1113 installer_state.system_install(), | |
| 1114 BrowserDistribution::CHROME_BROWSER); | |
| 1115 // This operation only applies when updating multi-install Chrome to | |
| 1116 // single-install. | |
| 1117 if (!chrome_state || !chrome_state->is_multi_install()) | |
| 1118 return; | |
| 1119 | |
| 1120 const ProductState* binaries_state = original_state.GetProductState( | |
| 1121 installer_state.system_install(), | |
| 1122 BrowserDistribution::CHROME_BINARIES); | |
| 1123 | |
| 1124 // There is nothing to be done if the binaries do not have stats. | |
| 1125 DWORD usagestats = 0; | |
| 1126 if (!binaries_state || !binaries_state->GetUsageStats(&usagestats)) | |
| 1127 return; | |
| 1128 | |
| 1129 // Write the value that was read to Chrome's ClientState key. | |
| 1130 install_list->AddSetRegValueWorkItem( | |
| 1131 installer_state.root_key(), | |
| 1132 chrome_product->distribution()->GetStateKey(), | |
| 1133 KEY_WOW64_32KEY, | |
| 1134 google_update::kRegUsageStatsField, | |
| 1135 usagestats, | |
| 1136 true); | |
| 1137 } | |
| 1138 | |
| 1095 bool AppendPostInstallTasks(const InstallerState& installer_state, | 1139 bool AppendPostInstallTasks(const InstallerState& installer_state, |
| 1096 const base::FilePath& setup_path, | 1140 const base::FilePath& setup_path, |
| 1097 const Version* current_version, | 1141 const Version* current_version, |
| 1098 const Version& new_version, | 1142 const Version& new_version, |
| 1099 const base::FilePath& temp_path, | 1143 const base::FilePath& temp_path, |
| 1100 WorkItemList* post_install_task_list) { | 1144 WorkItemList* post_install_task_list) { |
| 1101 DCHECK(post_install_task_list); | 1145 DCHECK(post_install_task_list); |
| 1102 | 1146 |
| 1103 HKEY root = installer_state.root_key(); | 1147 HKEY root = installer_state.root_key(); |
| 1104 const Products& products = installer_state.products(); | 1148 const Products& products = installer_state.products(); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1303 add_language_identifier, | 1347 add_language_identifier, |
| 1304 install_list); | 1348 install_list); |
| 1305 | 1349 |
| 1306 AddDelegateExecuteWorkItems(installer_state, target_path, new_version, | 1350 AddDelegateExecuteWorkItems(installer_state, target_path, new_version, |
| 1307 product, install_list); | 1351 product, install_list); |
| 1308 | 1352 |
| 1309 AddActiveSetupWorkItems(installer_state, setup_path, new_version, product, | 1353 AddActiveSetupWorkItems(installer_state, setup_path, new_version, product, |
| 1310 install_list); | 1354 install_list); |
| 1311 } | 1355 } |
| 1312 | 1356 |
| 1357 // Ensure that the Clients key for the binaries is gone for single installs. | |
|
robertshield
2015/01/23 22:45:30
Do we need to double check to make sure this doesn
grt (UTC plus 2)
2015/01/24 02:25:15
Line 1343 adds the Clients key for Chrome itself,
| |
| 1358 if (!installer_state.is_multi_install()) { | |
| 1359 BrowserDistribution* binaries_dist = | |
| 1360 BrowserDistribution::GetSpecificDistribution( | |
| 1361 BrowserDistribution::CHROME_BINARIES); | |
| 1362 install_list->AddDeleteRegKeyWorkItem(root, | |
| 1363 binaries_dist->GetVersionKey(), | |
| 1364 KEY_WOW64_32KEY); | |
| 1365 } | |
| 1366 | |
| 1313 // TODO(huangs): Implement actual migration code and remove the hack below. | 1367 // TODO(huangs): Implement actual migration code and remove the hack below. |
| 1314 // If installing Chrome without the legacy stand-alone App Launcher (to be | 1368 // If installing Chrome without the legacy stand-alone App Launcher (to be |
| 1315 // handled later), add "shadow" App Launcher registry keys so Google Update | 1369 // handled later), add "shadow" App Launcher registry keys so Google Update |
| 1316 // would recognize the "dr" value in the App Launcher ClientState key. | 1370 // would recognize the "dr" value in the App Launcher ClientState key. |
| 1317 // Checking .is_multi_install() excludes Chrome Canary and stand-alone Chrome. | 1371 // Checking .is_multi_install() excludes Chrome Canary and stand-alone Chrome. |
| 1318 if (installer_state.is_multi_install() && | 1372 if (installer_state.is_multi_install() && |
| 1319 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) && | 1373 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) && |
| 1320 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { | 1374 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
| 1321 BrowserDistribution* shadow_app_launcher_dist = | 1375 BrowserDistribution* shadow_app_launcher_dist = |
| 1322 BrowserDistribution::GetSpecificDistribution( | 1376 BrowserDistribution::GetSpecificDistribution( |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1334 AddProductSpecificWorkItems(original_state, | 1388 AddProductSpecificWorkItems(original_state, |
| 1335 installer_state, | 1389 installer_state, |
| 1336 setup_path, | 1390 setup_path, |
| 1337 new_version, | 1391 new_version, |
| 1338 current_version == NULL, | 1392 current_version == NULL, |
| 1339 install_list); | 1393 install_list); |
| 1340 | 1394 |
| 1341 // Copy over brand, usagestats, and other values. | 1395 // Copy over brand, usagestats, and other values. |
| 1342 AddGoogleUpdateWorkItems(original_state, installer_state, install_list); | 1396 AddGoogleUpdateWorkItems(original_state, installer_state, install_list); |
| 1343 | 1397 |
| 1398 // Migrate usagestats back to Chrome. | |
| 1399 AddMigrateUsageStatesWorkItems(original_state, installer_state, install_list); | |
| 1400 | |
| 1344 // Append the tasks that run after the installation. | 1401 // Append the tasks that run after the installation. |
| 1345 AppendPostInstallTasks(installer_state, | 1402 AppendPostInstallTasks(installer_state, |
| 1346 setup_path, | 1403 setup_path, |
| 1347 current_version, | 1404 current_version, |
| 1348 new_version, | 1405 new_version, |
| 1349 temp_path, | 1406 temp_path, |
| 1350 install_list); | 1407 install_list); |
| 1351 } | 1408 } |
| 1352 | 1409 |
| 1353 void AddRegisterComDllWorkItems(const base::FilePath& dll_folder, | 1410 void AddRegisterComDllWorkItems(const base::FilePath& dll_folder, |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1651 // Unconditionally remove the legacy Quick Enable command from the binaries. | 1708 // 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 | 1709 // Do this even if multi-install Chrome isn't installed to ensure that it is |
| 1653 // not left behind in any case. | 1710 // not left behind in any case. |
| 1654 work_item_list->AddDeleteRegKeyWorkItem( | 1711 work_item_list->AddDeleteRegKeyWorkItem( |
| 1655 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) | 1712 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) |
| 1656 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + | 1713 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + |
| 1657 " command"); | 1714 " command"); |
| 1658 } | 1715 } |
| 1659 | 1716 |
| 1660 } // namespace installer | 1717 } // namespace installer |
| OLD | NEW |