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

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
« no previous file with comments | « chrome/installer/setup/install_worker.h ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
908 const InstallationState& machine_state,
909 const FilePath* setup_path,
910 const Version* new_version,
911 WorkItemList* work_item_list) {
912 DCHECK(setup_path ||
913 installer_state.operation() == InstallerState::UNINSTALL);
914 DCHECK(new_version ||
915 installer_state.operation() == InstallerState::UNINSTALL);
916 DCHECK(work_item_list);
917
918 const bool system_install = installer_state.system_install();
919 bool have_multi_chrome = false;
920 bool have_chrome_frame = false;
921
922 // STEP 1: Figure out the state of the machine before the operation.
923 const ProductState* product_state = NULL;
924
925 // Is multi-install Chrome already on the machine?
926 product_state =
927 machine_state.GetProductState(system_install,
928 BrowserDistribution::CHROME_BROWSER);
929 if (product_state != NULL && product_state->is_multi_install())
930 have_multi_chrome = true;
931
932 // Is Chrome Frame !ready-mode already on the machine?
933 product_state =
934 machine_state.GetProductState(system_install,
935 BrowserDistribution::CHROME_FRAME);
936 if (product_state != NULL &&
937 !product_state->uninstall_command().HasSwitch(
938 switches::kChromeFrameReadyMode))
939 have_chrome_frame = true;
940
941 // STEP 2: Now take into account the current operation.
942 const Product* product = NULL;
943
944 if (installer_state.operation() == InstallerState::UNINSTALL) {
945 // Maybe forget about multi-install Chrome.
tommi (sloooow) - chröme 2011/03/02 20:30:58 This reads like a question without the question ma
grt (UTC plus 2) 2011/03/02 20:44:47 A better comment would be "Forget about multi-inst
946 product =
947 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
948 if (product != NULL && installer_state.is_multi_install())
949 have_multi_chrome = false;
950
951 // Maybe forget about Chrome Frame. Note that we don't bother to check
952 // !HasOption(kOptionReadyMode) since have_chrome_frame should have been
953 // false for that case in the first place. It's odd if it wasn't, but the
954 // right thing to do in that case is to proceed with the thought that CF
955 // will not be installed in any sense when we reach the finish line.
956 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME) != NULL)
957 have_chrome_frame = false;
958 } else {
959 // Maybe we're installing multi-install Chrome.
robertshield 2011/03/02 20:58:04 nit: "Maybe" -> "Check if" here and elsewhere in t
grt (UTC plus 2) 2011/03/02 21:06:37 Done.
960 product =
961 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
962 if (product != NULL && installer_state.is_multi_install())
963 have_multi_chrome = true;
964
965 // Maybe we're installing Chrome Frame !ready-mode.
966 product = installer_state.FindProduct(BrowserDistribution::CHROME_FRAME);
967 if (product != NULL && !product->HasOption(kOptionReadyMode))
968 have_chrome_frame = true;
969 }
970
971 // STEP 3: Decide what to do based on the final state of things.
972 enum QuickEnableOperation {
973 DO_NOTHING,
974 ADD_COMMAND,
975 REMOVE_COMMAND
976 } operation = DO_NOTHING;
977 FilePath binaries_setup_path;
978
979 if (have_chrome_frame) {
980 // Chrome Frame !ready-mode is or will be installed. Unconditionally remove
981 // the quick-enable-cf command from the binaries. We do this even if
982 // multi-install Chrome isn't installed since we don't want them left
983 // behind in any case.
984 operation = REMOVE_COMMAND;
985 } else if (have_multi_chrome) {
986 // Chrome Frame isn't (to be) installed, or is (to be) in ready-mode but
robertshield 2011/03/02 20:58:04 Consider rephrasing to "Chrome Frame isn't (to be)
grt (UTC plus 2) 2011/03/02 21:06:37 Done.
987 // multi-install Chrome is. Add the quick-enable-cf command to the
988 // binaries.
989 operation = ADD_COMMAND;
990 // The path to setup.exe contains the version of the Chrome binaries, so it
991 // takes a little work to get it right.
992 if (installer_state.operation() == InstallerState::UNINSTALL) {
993 // Some product (Chrome Frame) is being uninstalled. Use the path to the
robertshield 2011/03/02 20:58:04 Simplify to "Chrome Frame is being uninstalled."
grt (UTC plus 2) 2011/03/02 21:06:37 Done.
994 // currently installed Chrome setup.exe.
995 product_state =
996 machine_state.GetProductState(system_install,
997 BrowserDistribution::CHROME_BROWSER);
998 DCHECK(product_state);
999 binaries_setup_path = product_state->uninstall_command().GetProgram();
1000 } else {
1001 // Some product (Chrome) is being installed, updated, or otherwise being
robertshield 2011/03/02 20:58:04 Simplify to "Chrome is being [...]
grt (UTC plus 2) 2011/03/02 21:06:37 Done.
1002 // operated on. Use the path to the given |setup_path| in the normal
1003 // location of multi-install Chrome of the given |version|.
1004 DCHECK(installer_state.is_multi_install());
1005 binaries_setup_path =
1006 installer_state.GetInstallerDirectory(*new_version).Append(
1007 setup_path->BaseName());
1008 }
1009 }
1010
1011 // STEP 4: Take action.
1012 if (operation != DO_NOTHING) {
1013 // Get the path to the quick-enable-cf command for the binaries.
1014 BrowserDistribution* binaries =
1015 BrowserDistribution::GetSpecificDistribution(
1016 BrowserDistribution::CHROME_BINARIES);
1017 std::wstring cmd_key(binaries->GetVersionKey());
1018 cmd_key.append(1, L'\\').append(google_update::kRegCommandsKey)
1019 .append(1, L'\\').append(kCmdQuickEnableCf);
1020
1021 if (operation == ADD_COMMAND) {
1022 DCHECK(!binaries_setup_path.empty());
1023 CommandLine cmd_line(binaries_setup_path);
1024 cmd_line.AppendSwitch(switches::kMultiInstall);
1025 if (installer_state.system_install())
1026 cmd_line.AppendSwitch(switches::kSystemLevel);
1027 if (installer_state.verbose_logging())
1028 cmd_line.AppendSwitch(switches::kVerboseLogging);
1029 cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable);
1030 ProductCommand cmd(cmd_line.command_line_string(), true, true);
1031 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list);
1032 } else {
1033 DCHECK(operation == REMOVE_COMMAND);
1034 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(),
1035 cmd_key)->set_log_message(
1036 "removing quick-enable-cf command");
1037 }
1038 }
1039 }
1040
904 } // namespace installer 1041 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_worker.h ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698