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

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

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

Powered by Google App Engine
This is Rietveld 408576698