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

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

Issue 6588003: Add support for the quick-enable-cf command to the installer. This encompase... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <shlobj.h> 10 #include <shlobj.h>
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 install_list); 608 install_list);
609 } 609 }
610 610
611 // Add any remaining work items that involve special settings for 611 // Add any remaining work items that involve special settings for
612 // each product. 612 // each product.
613 AddProductSpecificWorkItems(original_state, installer_state, setup_path, 613 AddProductSpecificWorkItems(original_state, installer_state, setup_path,
614 new_version, install_list); 614 new_version, install_list);
615 615
616 AddGoogleUpdateWorkItems(installer_state, install_list); 616 AddGoogleUpdateWorkItems(installer_state, install_list);
617 617
618 AddQuickEnableWorkItems(installer_state, original_state, &setup_path,
619 &new_version, install_list);
620
618 // Append the tasks that run after the installation. 621 // Append the tasks that run after the installation.
619 AppendPostInstallTasks(installer_state, 622 AppendPostInstallTasks(installer_state,
620 setup_path, 623 setup_path,
621 new_chrome_exe, 624 new_chrome_exe,
622 current_version->get(), 625 current_version->get(),
623 new_version, 626 new_version,
624 temp_path, 627 temp_path,
625 install_list); 628 install_list);
626 } 629 }
627 630
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 } else { 897 } else {
895 VLOG(1) << kIERefreshPolicy << " not supported."; 898 VLOG(1) << kIERefreshPolicy << " not supported.";
896 } 899 }
897 900
898 FreeLibrary(ieframe); 901 FreeLibrary(ieframe);
899 } else { 902 } else {
900 VLOG(1) << "Cannot load " << kIEFrameDll; 903 VLOG(1) << "Cannot load " << kIEFrameDll;
901 } 904 }
902 } 905 }
903 906
907 void AddQuickEnableWorkItems(const InstallerState& installer_state,
grt (UTC plus 2) 2011/03/02 19:48:28 This function made me so sad that I rewrote it. T
tommi (sloooow) - chröme 2011/03/02 20:30:58 thanks. more easily digestible :)
grt (UTC plus 2) 2011/03/02 20:44:47 <burp>
908 const InstallationState& machine_state,
909 const FilePath* setup_path,
910 const Version* new_version,
911 WorkItemList* work_item_list) {
912 DCHECK(work_item_list);
913
914 enum QuickEnableOperation {
915 DO_NOTHING,
916 ADD_COMMAND,
917 REMOVE_COMMAND
918 } operation = DO_NOTHING;
919 const Version* binaries_version = NULL;
920 FilePath binaries_setup_path;
921
922 if (installer_state.operation() == InstallerState::UNINSTALL) {
923 // Add the quick-enable command if Chrome Frame single, multi, or ready-mode
924 // is being uninstalled, Chrome multi is installed, and Chrome multi is not
925 // being uninstalled.
926 const ProductState* chrome =
927 machine_state.GetProductState(installer_state.system_install(),
928 BrowserDistribution::CHROME_BROWSER);
929 if (installer_state.FindProduct(
930 BrowserDistribution::CHROME_FRAME) != NULL &&
931 chrome != NULL && chrome->is_multi_install() &&
932 installer_state.FindProduct(
933 BrowserDistribution::CHROME_BROWSER) == NULL) {
934 operation = ADD_COMMAND;
935 // Chrome multi's uninstall command has the proper path to setup.exe.
936 binaries_setup_path = chrome->uninstall_command().GetProgram();
937 }
938 } else {
robertshield 2011/03/02 14:58:57 Can we move the DCHECKS on setup_path and new_vers
grt (UTC plus 2) 2011/03/02 19:48:28 Done.
939 // Delete the quick-enable command if Chrome Frame single or Chrome Frame
940 // multi (not ready-mode) is being installed. Note that the command can
941 // only be present if the binaries are already installed, but we try to
942 // remove it in any case just to be sure.
943 const Product* cf =
944 installer_state.FindProduct(BrowserDistribution::CHROME_FRAME);
945 const Product* chrome =
946 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
947 if (cf != NULL && (!installer_state.is_multi_install() ||
948 !cf->HasOption(installer::kOptionReadyMode))) {
949 operation = REMOVE_COMMAND;
950 } else if (cf != NULL) {
951 // Add the quick-enable command if Chrome Frame ready-mode is being
952 // installed.
953 DCHECK(cf->HasOption(installer::kOptionReadyMode));
tommi (sloooow) - chröme 2011/03/01 23:33:13 couldn't we also get here for a 'single' install (
grt (UTC plus 2) 2011/03/02 19:48:28 I don't think so (at least, that wasn't my plan).
954 DCHECK(setup_path);
955 DCHECK(new_version);
956 operation = ADD_COMMAND;
957 // This new version's setup.exe is the one we need.
958 binaries_version = new_version;
959 } else if (installer_state.is_multi_install() &&
960 machine_state.GetProductState(
961 installer_state.system_install(),
962 BrowserDistribution::CHROME_FRAME) == NULL) {
tommi (sloooow) - chröme 2011/03/01 23:33:13 What if there exists a system install of gcf and t
grt (UTC plus 2) 2011/03/02 19:48:28 Robert, Erik, and I just discussed this and reache
963 // Add the quick-enable command if Chrome Frame is not being installed,
964 // we're doing a multi-install of Chrome, and single Chrome Frame is not
965 // already installed.
966 DCHECK(installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER));
967 DCHECK(new_version);
968 operation = ADD_COMMAND;
969 // This new version's setup.exe is the one we need.
970 binaries_version = new_version;
971 } else {
972 // Else we're doing a single install of Chrome, so do nothing.
973 DCHECK(!installer_state.is_multi_install() && chrome != NULL);
974 }
975
976 // Get the proper path to setup.exe if needed.
977 if (operation == ADD_COMMAND) {
978 DCHECK(binaries_version);
979 DCHECK(!setup_path->empty());
980 binaries_setup_path =
981 installer_state.GetInstallerDirectory(*binaries_version).Append(
982 setup_path->BaseName());
983 }
984 }
985
986 if (operation != DO_NOTHING) {
987 BrowserDistribution* binaries =
988 BrowserDistribution::GetSpecificDistribution(
989 BrowserDistribution::CHROME_BINARIES);
990 std::wstring cmd_key(binaries->GetVersionKey());
991 cmd_key.append(1, L'\\').append(kCmdQuickEnableCf);
erikwright (departed) 2011/03/02 15:18:16 add \\Commands here, after the version key.
grt (UTC plus 2) 2011/03/02 19:48:28 Done.
992
993 if (operation == ADD_COMMAND) {
994 DCHECK(!binaries_setup_path.empty());
995 CommandLine cmd_line(binaries_setup_path);
996 cmd_line.AppendSwitch(switches::kMultiInstall);
997 if (installer_state.system_install())
998 cmd_line.AppendSwitch(switches::kSystemLevel);
999 if (installer_state.verbose_logging())
1000 cmd_line.AppendSwitch(switches::kVerboseLogging);
1001 cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable);
1002 ProductCommand cmd(cmd_line.command_line_string(), true, true);
1003 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list);
1004 } else {
1005 DCHECK(operation == REMOVE_COMMAND);
1006 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(),
1007 cmd_key)->set_log_message(
1008 "removing quick-enable-cf command");
1009 }
1010 }
1011 }
1012
904 } // namespace installer 1013 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698