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

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

Issue 110163004: Remove Chrome Frame ready-mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile fixes for mini_installer_test Created 7 years 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 373
374 void AddProductSpecificWorkItems(const InstallationState& original_state, 374 void AddProductSpecificWorkItems(const InstallationState& original_state,
375 const InstallerState& installer_state, 375 const InstallerState& installer_state,
376 const base::FilePath& setup_path, 376 const base::FilePath& setup_path,
377 const Version& new_version, 377 const Version& new_version,
378 WorkItemList* list) { 378 WorkItemList* list) {
379 const Products& products = installer_state.products(); 379 const Products& products = installer_state.products();
380 for (Products::const_iterator it = products.begin(); it < products.end(); 380 for (Products::const_iterator it = products.begin(); it < products.end();
381 ++it) { 381 ++it) {
382 const Product& p = **it; 382 const Product& p = **it;
383 if (p.is_chrome_frame()) {
384 AddChromeFrameWorkItems(original_state, installer_state, setup_path,
385 new_version, p, list);
386 }
387 if (p.is_chrome_app_host()) { 383 if (p.is_chrome_app_host()) {
388 AddInstallAppCommandWorkItems(installer_state, original_state, 384 AddInstallAppCommandWorkItems(installer_state, original_state,
389 new_version, p, list); 385 new_version, p, list);
390 } 386 }
391 if (p.is_chrome()) { 387 if (p.is_chrome()) {
392 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p, 388 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p,
393 list); 389 list);
394 AddInstallExtensionCommandWorkItem(installer_state, original_state, 390 AddInstallExtensionCommandWorkItem(installer_state, original_state,
395 setup_path, new_version, p, list); 391 setup_path, new_version, p, list);
396 } 392 }
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 // Do not quote the command line for the MSI invocation. 675 // Do not quote the command line for the MSI invocation.
680 base::FilePath install_path(installer_state.target_path()); 676 base::FilePath install_path(installer_state.target_path());
681 base::FilePath installer_path( 677 base::FilePath installer_path(
682 installer_state.GetInstallerDirectory(new_version)); 678 installer_state.GetInstallerDirectory(new_version));
683 installer_path = installer_path.Append(setup_path.BaseName()); 679 installer_path = installer_path.Append(setup_path.BaseName());
684 680
685 CommandLine uninstall_arguments(CommandLine::NO_PROGRAM); 681 CommandLine uninstall_arguments(CommandLine::NO_PROGRAM);
686 AppendUninstallCommandLineFlags(installer_state, product, 682 AppendUninstallCommandLineFlags(installer_state, product,
687 &uninstall_arguments); 683 &uninstall_arguments);
688 684
689 // If Chrome Frame is installed in Ready Mode, add --chrome-frame to Chrome's
690 // uninstall entry. We skip this processing in case of uninstall since this
691 // means that Chrome Frame is being uninstalled, so there's no need to do any
692 // looping.
693 if (product.is_chrome() &&
694 installer_state.operation() != InstallerState::UNINSTALL) {
695 const Product* chrome_frame =
696 installer_state.FindProduct(BrowserDistribution::CHROME_FRAME);
697 if (chrome_frame && chrome_frame->HasOption(kOptionReadyMode))
698 chrome_frame->AppendProductFlags(&uninstall_arguments);
699 }
700
701 string16 update_state_key(browser_dist->GetStateKey()); 685 string16 update_state_key(browser_dist->GetStateKey());
702 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); 686 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key);
703 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, 687 install_list->AddSetRegValueWorkItem(reg_root, update_state_key,
704 installer::kUninstallStringField, installer_path.value(), true); 688 installer::kUninstallStringField, installer_path.value(), true);
705 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, 689 install_list->AddSetRegValueWorkItem(reg_root, update_state_key,
706 installer::kUninstallArgumentsField, 690 installer::kUninstallArgumentsField,
707 uninstall_arguments.GetCommandLineString(), true); 691 uninstall_arguments.GetCommandLineString(), true);
708 692
709 // MSI installations will manage their own uninstall shortcuts. 693 // MSI installations will manage their own uninstall shortcuts.
710 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { 694 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) {
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 DCHECK(work_item_list); 1261 DCHECK(work_item_list);
1278 DWORD msi_value = set ? 1 : 0; 1262 DWORD msi_value = set ? 1 : 0;
1279 WorkItem* set_msi_work_item = work_item_list->AddSetRegValueWorkItem( 1263 WorkItem* set_msi_work_item = work_item_list->AddSetRegValueWorkItem(
1280 installer_state.root_key(), dist->GetStateKey(), 1264 installer_state.root_key(), dist->GetStateKey(),
1281 google_update::kRegMSIField, msi_value, true); 1265 google_update::kRegMSIField, msi_value, true);
1282 DCHECK(set_msi_work_item); 1266 DCHECK(set_msi_work_item);
1283 set_msi_work_item->set_ignore_failure(true); 1267 set_msi_work_item->set_ignore_failure(true);
1284 set_msi_work_item->set_log_message("Could not write MSI marker!"); 1268 set_msi_work_item->set_log_message("Could not write MSI marker!");
1285 } 1269 }
1286 1270
1287 void AddChromeFrameWorkItems(const InstallationState& original_state,
1288 const InstallerState& installer_state,
1289 const base::FilePath& setup_path,
1290 const Version& new_version,
1291 const Product& product,
1292 WorkItemList* list) {
1293 DCHECK(product.is_chrome_frame());
1294 if (!installer_state.is_multi_install()) {
1295 VLOG(1) << "Not adding GCF specific work items for single install.";
1296 return;
1297 }
1298
1299 string16 version_key(product.distribution()->GetVersionKey());
1300 bool ready_mode = product.HasOption(kOptionReadyMode);
1301 HKEY root = installer_state.root_key();
1302 const bool is_install =
1303 (installer_state.operation() != InstallerState::UNINSTALL);
1304 bool update_chrome_uninstall_command = false;
1305 BrowserDistribution* dist =
1306 installer_state.multi_package_binaries_distribution();
1307 if (ready_mode) {
1308 // If GCF is being installed in ready mode, we write an entry to the
1309 // multi-install state key. If the value already exists, we will not
1310 // overwrite it since the user might have opted out.
1311 list->AddCreateRegKeyWorkItem(root, dist->GetStateKey());
1312 list->AddSetRegValueWorkItem(root, dist->GetStateKey(),
1313 kChromeFrameReadyModeField,
1314 static_cast<int64>(is_install ? 1 : 0), // The value we want to set.
1315 !is_install); // Overwrite existing value.
1316 if (is_install) {
1317 base::FilePath installer_path(installer_state
1318 .GetInstallerDirectory(new_version).Append(setup_path.BaseName()));
1319
1320 CommandLine basic_cl(installer_path);
1321 basic_cl.AppendSwitch(switches::kChromeFrame);
1322 basic_cl.AppendSwitch(switches::kMultiInstall);
1323
1324 if (installer_state.system_install())
1325 basic_cl.AppendSwitch(switches::kSystemLevel);
1326
1327 CommandLine temp_opt_out(basic_cl);
1328 temp_opt_out.AppendSwitch(switches::kChromeFrameReadyModeTempOptOut);
1329
1330 CommandLine end_temp_opt_out(basic_cl);
1331 end_temp_opt_out.AppendSwitch(
1332 switches::kChromeFrameReadyModeEndTempOptOut);
1333
1334 CommandLine opt_out(installer_path);
1335 AppendUninstallCommandLineFlags(installer_state, product, &opt_out);
1336 // Force Uninstall silences the prompt to reboot to complete uninstall.
1337 opt_out.AppendSwitch(switches::kForceUninstall);
1338
1339 CommandLine opt_in(basic_cl);
1340 opt_in.AppendSwitch(switches::kChromeFrameReadyModeOptIn);
1341
1342 list->AddSetRegValueWorkItem(root, version_key,
1343 google_update::kRegCFTempOptOutCmdField,
1344 temp_opt_out.GetCommandLineString(), true);
1345 list->AddSetRegValueWorkItem(root, version_key,
1346 google_update::kRegCFEndTempOptOutCmdField,
1347 end_temp_opt_out.GetCommandLineString(),
1348 true);
1349 list->AddSetRegValueWorkItem(root, version_key,
1350 google_update::kRegCFOptOutCmdField,
1351 opt_out.GetCommandLineString(), true);
1352 list->AddSetRegValueWorkItem(root, version_key,
1353 google_update::kRegCFOptInCmdField,
1354 opt_in.GetCommandLineString(), true);
1355 } else {
1356 // If Chrome is not also being uninstalled, we need to update its command
1357 // line so that it doesn't include uninstalling Chrome Frame now.
1358 update_chrome_uninstall_command =
1359 (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) ==
1360 NULL);
1361 }
1362 } else {
1363 // It doesn't matter here if we're installing or uninstalling Chrome Frame.
1364 // If ready mode isn't specified on the command line for installs, we need
1365 // to delete the ready mode flag from the registry if it exists - this
1366 // constitutes an opt-in for the user. If we're uninstalling CF and ready
1367 // mode isn't specified on the command line, that means that CF wasn't
1368 // installed with ready mode enabled (the --ready-mode switch should be set
1369 // in the registry) so deleting the value should have no effect.
1370 // In both cases (install/uninstall), we need to make sure that Chrome's
1371 // uninstallation command line does not include the --chrome-frame switch
1372 // so that uninstalling Chrome will no longer uninstall Chrome Frame.
1373
1374 list->AddDeleteRegValueWorkItem(root, dist->GetStateKey(),
1375 kChromeFrameReadyModeField);
1376
1377 const Product* chrome =
1378 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
1379 if (chrome) {
1380 // Chrome is already a part of this installation run, so we can assume
1381 // that the uninstallation arguments will be updated correctly.
1382 } else {
1383 // Chrome is not a part of this installation run, so we have to explicitly
1384 // check if Chrome is installed, and if so, update its uninstallation
1385 // command lines.
1386 const ProductState* chrome_state = original_state.GetProductState(
1387 installer_state.system_install(),
1388 BrowserDistribution::CHROME_BROWSER);
1389 update_chrome_uninstall_command =
1390 (chrome_state != NULL) && chrome_state->is_multi_install();
1391 }
1392 }
1393
1394 if (!ready_mode || !is_install) {
1395 list->AddDeleteRegValueWorkItem(root, version_key,
1396 google_update::kRegCFTempOptOutCmdField);
1397 list->AddDeleteRegValueWorkItem(root, version_key,
1398 google_update::kRegCFEndTempOptOutCmdField);
1399 list->AddDeleteRegValueWorkItem(root, version_key,
1400 google_update::kRegCFOptOutCmdField);
1401 list->AddDeleteRegValueWorkItem(root, version_key,
1402 google_update::kRegCFOptInCmdField);
1403 }
1404
1405 if (update_chrome_uninstall_command) {
1406 // Chrome is not a part of this installation run, so we have to explicitly
1407 // check if Chrome is installed, and if so, update its uninstallation
1408 // command lines.
1409 const ProductState* chrome_state = original_state.GetProductState(
1410 installer_state.system_install(), BrowserDistribution::CHROME_BROWSER);
1411 if (chrome_state != NULL) {
1412 DCHECK(chrome_state->is_multi_install());
1413 Product chrome(BrowserDistribution::GetSpecificDistribution(
1414 BrowserDistribution::CHROME_BROWSER));
1415 chrome.InitializeFromUninstallCommand(chrome_state->uninstall_command());
1416 AddUninstallShortcutWorkItems(installer_state, setup_path,
1417 chrome_state->version(), chrome, list);
1418 } else {
1419 NOTREACHED() << "What happened to Chrome?";
1420 }
1421 }
1422 }
1423
1424 void AddDelegateExecuteWorkItems(const InstallerState& installer_state, 1271 void AddDelegateExecuteWorkItems(const InstallerState& installer_state,
1425 const base::FilePath& target_path, 1272 const base::FilePath& target_path,
1426 const Version& new_version, 1273 const Version& new_version,
1427 const Product& product, 1274 const Product& product,
1428 WorkItemList* list) { 1275 WorkItemList* list) {
1429 string16 handler_class_uuid; 1276 string16 handler_class_uuid;
1430 BrowserDistribution* dist = product.distribution(); 1277 BrowserDistribution* dist = product.distribution();
1431 if (!dist->GetCommandExecuteImplClsid(&handler_class_uuid)) { 1278 if (!dist->GetCommandExecuteImplClsid(&handler_class_uuid)) {
1432 if (InstallUtil::IsChromeSxSProcess()) { 1279 if (InstallUtil::IsChromeSxSProcess()) {
1433 CleanupBadCanaryDelegateExecuteRegistration(target_path, list); 1280 CleanupBadCanaryDelegateExecuteRegistration(target_path, list);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 if (installer_state.system_install()) 1552 if (installer_state.system_install())
1706 cmd_line.AppendSwitch(switches::kSystemLevel); 1553 cmd_line.AppendSwitch(switches::kSystemLevel);
1707 AppCommand cmd(cmd_line.GetCommandLineString()); 1554 AppCommand cmd(cmd_line.GetCommandLineString());
1708 cmd.set_sends_pings(true); 1555 cmd.set_sends_pings(true);
1709 cmd.set_is_web_accessible(true); 1556 cmd.set_is_web_accessible(true);
1710 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); 1557 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list);
1711 } 1558 }
1712 } 1559 }
1713 1560
1714 } // namespace installer 1561 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698