| 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 set_ignore_failure(true); | 475 set_ignore_failure(true); |
| 476 } | 476 } |
| 477 } | 477 } |
| 478 | 478 |
| 479 // Delete any new_chrome.exe if present (we will end up creating a new one | 479 // Delete any new_chrome.exe if present (we will end up creating a new one |
| 480 // if required) and then copy chrome.exe | 480 // if required) and then copy chrome.exe |
| 481 base::FilePath new_chrome_exe(target_path.Append(installer::kChromeNewExe)); | 481 base::FilePath new_chrome_exe(target_path.Append(installer::kChromeNewExe)); |
| 482 | 482 |
| 483 install_list->AddDeleteTreeWorkItem(new_chrome_exe, temp_path); | 483 install_list->AddDeleteTreeWorkItem(new_chrome_exe, temp_path); |
| 484 | 484 |
| 485 // TODO(grt): Remove this check in M35. | |
| 486 if (installer_state.IsChromeFrameRunning(original_state)) { | 485 if (installer_state.IsChromeFrameRunning(original_state)) { |
| 487 VLOG(1) << "Chrome Frame in use. Copying to new_chrome.exe"; | 486 VLOG(1) << "Chrome Frame in use. Copying to new_chrome.exe"; |
| 488 install_list->AddCopyTreeWorkItem( | 487 install_list->AddCopyTreeWorkItem( |
| 489 src_path.Append(installer::kChromeExe).value(), | 488 src_path.Append(installer::kChromeExe).value(), |
| 490 new_chrome_exe.value(), | 489 new_chrome_exe.value(), |
| 491 temp_path.value(), | 490 temp_path.value(), |
| 492 WorkItem::ALWAYS); | 491 WorkItem::ALWAYS); |
| 493 } else { | 492 } else { |
| 494 install_list->AddCopyTreeWorkItem( | 493 install_list->AddCopyTreeWorkItem( |
| 495 src_path.Append(installer::kChromeExe).value(), | 494 src_path.Append(installer::kChromeExe).value(), |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 // For system-level installs, make sure the ClientStateMedium key for the | 911 // For system-level installs, make sure the ClientStateMedium key for the |
| 913 // binaries exists. | 912 // binaries exists. |
| 914 if (system_install) { | 913 if (system_install) { |
| 915 install_list->AddCreateRegKeyWorkItem( | 914 install_list->AddCreateRegKeyWorkItem( |
| 916 root_key, | 915 root_key, |
| 917 installer_state.multi_package_binaries_distribution()-> | 916 installer_state.multi_package_binaries_distribution()-> |
| 918 GetStateMediumKey().c_str()); | 917 GetStateMediumKey().c_str()); |
| 919 } | 918 } |
| 920 | 919 |
| 921 // Creating the ClientState key for binaries, if we're migrating to multi then | 920 // Creating the ClientState key for binaries, if we're migrating to multi then |
| 922 // copy over Chrome's brand code if it has one. | 921 // copy over Chrome's brand code if it has one. Chrome Frame currently never |
| 922 // has a brand code. |
| 923 if (installer_state.state_type() != BrowserDistribution::CHROME_BINARIES) { | 923 if (installer_state.state_type() != BrowserDistribution::CHROME_BINARIES) { |
| 924 const ProductState* chrome_product_state = | 924 const ProductState* chrome_product_state = |
| 925 original_state.GetNonVersionedProductState( | 925 original_state.GetNonVersionedProductState( |
| 926 system_install, BrowserDistribution::CHROME_BROWSER); | 926 system_install, BrowserDistribution::CHROME_BROWSER); |
| 927 | 927 |
| 928 const base::string16& brand(chrome_product_state->brand()); | 928 const base::string16& brand(chrome_product_state->brand()); |
| 929 if (!brand.empty()) { | 929 if (!brand.empty()) { |
| 930 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); | 930 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); |
| 931 // Write Chrome's brand code to the multi key. Never overwrite the value | 931 // Write Chrome's brand code to the multi key. Never overwrite the value |
| 932 // if one is already present (although this shouldn't happen). | 932 // if one is already present (although this shouldn't happen). |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 // values. | 1067 // values. |
| 1068 if (dist->GetType() != BrowserDistribution::CHROME_BINARIES) { | 1068 if (dist->GetType() != BrowserDistribution::CHROME_BINARIES) { |
| 1069 CommandLine product_rename_cmd(rename); | 1069 CommandLine product_rename_cmd(rename); |
| 1070 products[i]->AppendRenameFlags(&product_rename_cmd); | 1070 products[i]->AppendRenameFlags(&product_rename_cmd); |
| 1071 in_use_update_work_items->AddSetRegValueWorkItem( | 1071 in_use_update_work_items->AddSetRegValueWorkItem( |
| 1072 root, version_key, google_update::kRegRenameCmdField, | 1072 root, version_key, google_update::kRegRenameCmdField, |
| 1073 product_rename_cmd.GetCommandLineString(), true); | 1073 product_rename_cmd.GetCommandLineString(), true); |
| 1074 } | 1074 } |
| 1075 } | 1075 } |
| 1076 | 1076 |
| 1077 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { |
| 1078 AddCopyIELowRightsPolicyWorkItems(installer_state, |
| 1079 in_use_update_work_items.get()); |
| 1080 } |
| 1081 |
| 1077 post_install_task_list->AddWorkItem(in_use_update_work_items.release()); | 1082 post_install_task_list->AddWorkItem(in_use_update_work_items.release()); |
| 1078 } | 1083 } |
| 1079 | 1084 |
| 1080 // Append work items that will be executed if this was NOT an in-use update. | 1085 // Append work items that will be executed if this was NOT an in-use update. |
| 1081 { | 1086 { |
| 1082 scoped_ptr<WorkItemList> regular_update_work_items( | 1087 scoped_ptr<WorkItemList> regular_update_work_items( |
| 1083 WorkItem::CreateConditionalWorkItemList( | 1088 WorkItem::CreateConditionalWorkItemList( |
| 1084 new Not(new ConditionRunIfFileExists(new_chrome_exe)))); | 1089 new Not(new ConditionRunIfFileExists(new_chrome_exe)))); |
| 1085 regular_update_work_items->set_log_message("RegularUpdateWorkItemList"); | 1090 regular_update_work_items->set_log_message("RegularUpdateWorkItemList"); |
| 1086 | 1091 |
| 1087 // Since this was not an in-use-update, delete 'opv', 'cpv', and 'cmd' keys. | 1092 // Since this was not an in-use-update, delete 'opv', 'cpv', and 'cmd' keys. |
| 1088 for (size_t i = 0; i < products.size(); ++i) { | 1093 for (size_t i = 0; i < products.size(); ++i) { |
| 1089 BrowserDistribution* dist = products[i]->distribution(); | 1094 BrowserDistribution* dist = products[i]->distribution(); |
| 1090 base::string16 version_key(dist->GetVersionKey()); | 1095 base::string16 version_key(dist->GetVersionKey()); |
| 1091 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 1096 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, |
| 1092 google_update::kRegOldVersionField); | 1097 google_update::kRegOldVersionField); |
| 1093 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 1098 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, |
| 1094 google_update::kRegCriticalVersionField); | 1099 google_update::kRegCriticalVersionField); |
| 1095 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 1100 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, |
| 1096 google_update::kRegRenameCmdField); | 1101 google_update::kRegRenameCmdField); |
| 1097 } | 1102 } |
| 1098 | 1103 |
| 1104 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { |
| 1105 AddDeleteOldIELowRightsPolicyWorkItems(installer_state, |
| 1106 regular_update_work_items.get()); |
| 1107 } |
| 1108 |
| 1099 post_install_task_list->AddWorkItem(regular_update_work_items.release()); | 1109 post_install_task_list->AddWorkItem(regular_update_work_items.release()); |
| 1100 } | 1110 } |
| 1101 | 1111 |
| 1102 AddRegisterComDllWorkItemsForPackage(installer_state, current_version, | 1112 AddRegisterComDllWorkItemsForPackage(installer_state, current_version, |
| 1103 new_version, post_install_task_list); | 1113 new_version, post_install_task_list); |
| 1104 | 1114 |
| 1105 // If we're told that we're an MSI install, make sure to set the marker | 1115 // If we're told that we're an MSI install, make sure to set the marker |
| 1106 // in the client state key so that future updates do the right thing. | 1116 // in the client state key so that future updates do the right thing. |
| 1107 if (installer_state.is_msi()) { | 1117 if (installer_state.is_msi()) { |
| 1108 for (size_t i = 0; i < products.size(); ++i) { | 1118 for (size_t i = 0; i < products.size(); ++i) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1136 WorkItemList* install_list) { | 1146 WorkItemList* install_list) { |
| 1137 DCHECK(install_list); | 1147 DCHECK(install_list); |
| 1138 | 1148 |
| 1139 const base::FilePath& target_path = installer_state.target_path(); | 1149 const base::FilePath& target_path = installer_state.target_path(); |
| 1140 | 1150 |
| 1141 // A temp directory that work items need and the actual install directory. | 1151 // A temp directory that work items need and the actual install directory. |
| 1142 install_list->AddCreateDirWorkItem(temp_path); | 1152 install_list->AddCreateDirWorkItem(temp_path); |
| 1143 install_list->AddCreateDirWorkItem(target_path); | 1153 install_list->AddCreateDirWorkItem(target_path); |
| 1144 | 1154 |
| 1145 if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) || | 1155 if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) || |
| 1156 installer_state.FindProduct(BrowserDistribution::CHROME_FRAME) || |
| 1146 installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES)) { | 1157 installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES)) { |
| 1147 AddChromeWorkItems(original_state, | 1158 AddChromeWorkItems(original_state, |
| 1148 installer_state, | 1159 installer_state, |
| 1149 setup_path, | 1160 setup_path, |
| 1150 archive_path, | 1161 archive_path, |
| 1151 src_path, | 1162 src_path, |
| 1152 temp_path, | 1163 temp_path, |
| 1153 current_version, | 1164 current_version, |
| 1154 new_version, | 1165 new_version, |
| 1155 install_list); | 1166 install_list); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 void AddDeleteOldIELowRightsPolicyWorkItems( | 1381 void AddDeleteOldIELowRightsPolicyWorkItems( |
| 1371 const InstallerState& installer_state, | 1382 const InstallerState& installer_state, |
| 1372 WorkItemList* install_list) { | 1383 WorkItemList* install_list) { |
| 1373 DCHECK(install_list); | 1384 DCHECK(install_list); |
| 1374 | 1385 |
| 1375 base::string16 key_path; | 1386 base::string16 key_path; |
| 1376 GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &key_path); | 1387 GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &key_path); |
| 1377 install_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), key_path); | 1388 install_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), key_path); |
| 1378 } | 1389 } |
| 1379 | 1390 |
| 1391 // Adds work items to copy the chrome_launcher IE low rights elevation policy |
| 1392 // from the primary policy GUID to the "old" policy GUID. Take care not to |
| 1393 // perform the copy if there is already an old policy present, as the ones under |
| 1394 // the main kElevationPolicyGuid would then correspond to an intermediate |
| 1395 // version (current_version < pv < new_version). |
| 1396 void AddCopyIELowRightsPolicyWorkItems(const InstallerState& installer_state, |
| 1397 WorkItemList* install_list) { |
| 1398 DCHECK(install_list); |
| 1399 |
| 1400 base::string16 current_key_path; |
| 1401 base::string16 old_key_path; |
| 1402 |
| 1403 GetIELowRightsElevationPolicyKeyPath(CURRENT_ELEVATION_POLICY, |
| 1404 ¤t_key_path); |
| 1405 GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &old_key_path); |
| 1406 // Do not clobber existing old policies. |
| 1407 install_list->AddCopyRegKeyWorkItem(installer_state.root_key(), |
| 1408 current_key_path, old_key_path, |
| 1409 WorkItem::IF_NOT_PRESENT); |
| 1410 } |
| 1411 |
| 1380 void AppendUninstallCommandLineFlags(const InstallerState& installer_state, | 1412 void AppendUninstallCommandLineFlags(const InstallerState& installer_state, |
| 1381 const Product& product, | 1413 const Product& product, |
| 1382 CommandLine* uninstall_cmd) { | 1414 CommandLine* uninstall_cmd) { |
| 1383 DCHECK(uninstall_cmd); | 1415 DCHECK(uninstall_cmd); |
| 1384 | 1416 |
| 1385 uninstall_cmd->AppendSwitch(installer::switches::kUninstall); | 1417 uninstall_cmd->AppendSwitch(installer::switches::kUninstall); |
| 1386 | 1418 |
| 1387 // Append the product-specific uninstall flags. | 1419 // Append the product-specific uninstall flags. |
| 1388 product.AppendProductFlags(uninstall_cmd); | 1420 product.AppendProductFlags(uninstall_cmd); |
| 1389 if (installer_state.is_msi()) | 1421 if (installer_state.is_msi()) { |
| 1390 uninstall_cmd->AppendSwitch(installer::switches::kMsi); | 1422 uninstall_cmd->AppendSwitch(installer::switches::kMsi); |
| 1423 // See comment in uninstall.cc where we check for the kDeleteProfile switch. |
| 1424 if (product.is_chrome_frame()) { |
| 1425 uninstall_cmd->AppendSwitch(installer::switches::kDeleteProfile); |
| 1426 } |
| 1427 } |
| 1391 if (installer_state.system_install()) | 1428 if (installer_state.system_install()) |
| 1392 uninstall_cmd->AppendSwitch(installer::switches::kSystemLevel); | 1429 uninstall_cmd->AppendSwitch(installer::switches::kSystemLevel); |
| 1393 if (installer_state.verbose_logging()) | 1430 if (installer_state.verbose_logging()) |
| 1394 uninstall_cmd->AppendSwitch(installer::switches::kVerboseLogging); | 1431 uninstall_cmd->AppendSwitch(installer::switches::kVerboseLogging); |
| 1395 } | 1432 } |
| 1396 | 1433 |
| 1397 void RefreshElevationPolicy() { | 1434 void RefreshElevationPolicy() { |
| 1398 const wchar_t kIEFrameDll[] = L"ieframe.dll"; | 1435 const wchar_t kIEFrameDll[] = L"ieframe.dll"; |
| 1399 const char kIERefreshPolicy[] = "IERefreshElevationPolicy"; | 1436 const char kIERefreshPolicy[] = "IERefreshElevationPolicy"; |
| 1400 | 1437 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 // Unconditionally remove the legacy Quick Enable command from the binaries. | 1525 // Unconditionally remove the legacy Quick Enable command from the binaries. |
| 1489 // Do this even if multi-install Chrome isn't installed to ensure that it is | 1526 // Do this even if multi-install Chrome isn't installed to ensure that it is |
| 1490 // not left behind in any case. | 1527 // not left behind in any case. |
| 1491 work_item_list->AddDeleteRegKeyWorkItem( | 1528 work_item_list->AddDeleteRegKeyWorkItem( |
| 1492 installer_state.root_key(), cmd_key)->set_log_message( | 1529 installer_state.root_key(), cmd_key)->set_log_message( |
| 1493 "removing " + WideToASCII(kCmdQuickEnableCf) + " command"); | 1530 "removing " + WideToASCII(kCmdQuickEnableCf) + " command"); |
| 1494 | 1531 |
| 1495 } | 1532 } |
| 1496 | 1533 |
| 1497 } // namespace installer | 1534 } // namespace installer |
| OLD | NEW |