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

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

Issue 10213010: Don't register or use the DelegateExecute verb handler if it isn't present. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: logging tweak Created 8 years, 8 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/uninstall.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) 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>
11 #include <shlobj.h> 11 #include <shlobj.h>
12 #include <time.h> 12 #include <time.h>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/file_path.h" 16 #include "base/file_path.h"
17 #include "base/file_util.h"
17 #include "base/logging.h" 18 #include "base/logging.h"
18 #include "base/path_service.h" 19 #include "base/path_service.h"
19 #include "base/string_util.h" 20 #include "base/string_util.h"
20 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
21 #include "base/version.h" 22 #include "base/version.h"
22 #include "base/win/registry.h" 23 #include "base/win/registry.h"
23 #include "base/win/windows_version.h" 24 #include "base/win/windows_version.h"
24 #include "chrome/common/chrome_constants.h" 25 #include "chrome/common/chrome_constants.h"
25 #include "chrome/installer/setup/install.h" 26 #include "chrome/installer/setup/install.h"
26 #include "chrome/installer/setup/setup_constants.h" 27 #include "chrome/installer/setup/setup_constants.h"
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 const Products& products = installer_state.products(); 848 const Products& products = installer_state.products();
848 for (size_t i = 0; i < products.size(); ++i) { 849 for (size_t i = 0; i < products.size(); ++i) {
849 const Product* product = products[i]; 850 const Product* product = products[i];
850 851
851 AddUninstallShortcutWorkItems(installer_state, setup_path, new_version, 852 AddUninstallShortcutWorkItems(installer_state, setup_path, new_version,
852 install_list, *product); 853 install_list, *product);
853 854
854 AddVersionKeyWorkItems(root, product->distribution(), new_version, 855 AddVersionKeyWorkItems(root, product->distribution(), new_version,
855 add_language_identifier, install_list); 856 add_language_identifier, install_list);
856 857
857 AddDelegateExecuteWorkItems(original_state, installer_state, setup_path, 858 AddDelegateExecuteWorkItems(installer_state, src_path, new_version,
858 new_version, *product, install_list); 859 *product, install_list);
859 } 860 }
860 861
861 if (installer_state.is_multi_install()) { 862 if (installer_state.is_multi_install()) {
862 AddMultiUninstallWorkItems(installer_state, setup_path, new_version, 863 AddMultiUninstallWorkItems(installer_state, setup_path, new_version,
863 install_list); 864 install_list);
864 865
865 AddVersionKeyWorkItems(root, 866 AddVersionKeyWorkItems(root,
866 installer_state.multi_package_binaries_distribution(), new_version, 867 installer_state.multi_package_binaries_distribution(), new_version,
867 add_language_identifier, install_list); 868 add_language_identifier, install_list);
868 } 869 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 BrowserDistribution::CHROME_BROWSER)); 1055 BrowserDistribution::CHROME_BROWSER));
1055 chrome.InitializeFromUninstallCommand(chrome_state->uninstall_command()); 1056 chrome.InitializeFromUninstallCommand(chrome_state->uninstall_command());
1056 AddUninstallShortcutWorkItems(installer_state, setup_path, 1057 AddUninstallShortcutWorkItems(installer_state, setup_path,
1057 chrome_state->version(), list, chrome); 1058 chrome_state->version(), list, chrome);
1058 } else { 1059 } else {
1059 NOTREACHED() << "What happened to Chrome?"; 1060 NOTREACHED() << "What happened to Chrome?";
1060 } 1061 }
1061 } 1062 }
1062 } 1063 }
1063 1064
1064 void AddDelegateExecuteWorkItems(const InstallationState& original_state, 1065 void AddDelegateExecuteWorkItems(const InstallerState& installer_state,
1065 const InstallerState& installer_state, 1066 const FilePath& src_path,
1066 const FilePath& setup_path,
1067 const Version& new_version, 1067 const Version& new_version,
1068 const Product& product, 1068 const Product& product,
1069 WorkItemList* list) { 1069 WorkItemList* list) {
1070 string16 handler_class_uuid; 1070 string16 handler_class_uuid;
1071 string16 type_lib_uuid; 1071 string16 type_lib_uuid;
1072 string16 type_lib_version; 1072 string16 type_lib_version;
1073 string16 interface_uuid; 1073 string16 interface_uuid;
1074 BrowserDistribution* distribution = product.distribution(); 1074 BrowserDistribution* distribution = product.distribution();
1075 if (!distribution->GetDelegateExecuteHandlerData( 1075 if (!distribution->GetDelegateExecuteHandlerData(
1076 &handler_class_uuid, &type_lib_uuid, &type_lib_version, 1076 &handler_class_uuid, &type_lib_uuid, &type_lib_version,
1077 &interface_uuid)) { 1077 &interface_uuid)) {
1078 VLOG(1) << "No DelegateExecute verb handler processing to do for " 1078 VLOG(1) << "No DelegateExecute verb handler processing to do for "
1079 << distribution->GetAppShortCutName(); 1079 << distribution->GetAppShortCutName();
1080 return; 1080 return;
1081 } 1081 }
1082 1082
1083 VLOG(1) << "DelegateExecute verb handler COM registration.";
1084
1085 HKEY root = installer_state.root_key(); 1083 HKEY root = installer_state.root_key();
1086 const bool is_install = 1084 const bool is_install =
1087 (installer_state.operation() != InstallerState::UNINSTALL); 1085 (installer_state.operation() != InstallerState::UNINSTALL);
1088 string16 delegate_execute_path(L"Software\\Classes\\CLSID\\"); 1086 string16 delegate_execute_path(L"Software\\Classes\\CLSID\\");
1089 delegate_execute_path.append(handler_class_uuid); 1087 delegate_execute_path.append(handler_class_uuid);
1090 string16 typelib_path(L"Software\\Classes\\TypeLib\\"); 1088 string16 typelib_path(L"Software\\Classes\\TypeLib\\");
1091 typelib_path.append(type_lib_uuid); 1089 typelib_path.append(type_lib_uuid);
1092 string16 interface_path(L"Software\\Classes\\Interface\\"); 1090 string16 interface_path(L"Software\\Classes\\Interface\\");
1093 interface_path.append(interface_uuid); 1091 interface_path.append(interface_uuid);
1094 1092
1095 if (is_install) { 1093 // Add work items to register the handler iff it is present. Remove its
1094 // registration otherwise since builds after r132190 included it when it
1095 // wasn't strictly necessary.
1096 // TODO(grt): remove the extra check for the .exe when it's ever-present;
1097 // see also shell_util.cc's GetProgIdEntries.
1098 if (is_install &&
1099 file_util::PathExists(src_path.AppendASCII(new_version.GetString())
1100 .Append(kDelegateExecuteExe))) {
1101 VLOG(1) << "Adding DelegateExecute verb handler COM registration items.";
1102
1096 // The path to the exe (in the version directory). 1103 // The path to the exe (in the version directory).
1097 FilePath delegate_execute( 1104 FilePath delegate_execute(
1098 installer_state.target_path().AppendASCII(new_version.GetString())); 1105 installer_state.target_path().AppendASCII(new_version.GetString()));
1099 delegate_execute = delegate_execute.Append(kDelegateExecuteExe); 1106 delegate_execute = delegate_execute.Append(kDelegateExecuteExe);
1100 1107
1101 // Command-line featuring the quoted path to the exe. 1108 // Command-line featuring the quoted path to the exe.
1102 string16 command(1, L'"'); 1109 string16 command(1, L'"');
1103 command.append(delegate_execute.value()).append(1, L'"'); 1110 command.append(delegate_execute.value()).append(1, L'"');
1104 1111
1105 // Register the CommandExecuteImpl class at 1112 // Register the CommandExecuteImpl class at
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 list->AddCreateRegKeyWorkItem(root, subkey); 1170 list->AddCreateRegKeyWorkItem(root, subkey);
1164 list->AddSetRegValueWorkItem(root, subkey, L"", kPSOAInterfaceUuid, true); 1171 list->AddSetRegValueWorkItem(root, subkey, L"", kPSOAInterfaceUuid, true);
1165 1172
1166 subkey.assign(interface_path).append(L"\\TypeLib"); 1173 subkey.assign(interface_path).append(L"\\TypeLib");
1167 list->AddCreateRegKeyWorkItem(root, subkey); 1174 list->AddCreateRegKeyWorkItem(root, subkey);
1168 list->AddSetRegValueWorkItem(root, subkey, L"", type_lib_uuid, true); 1175 list->AddSetRegValueWorkItem(root, subkey, L"", type_lib_uuid, true);
1169 list->AddSetRegValueWorkItem(root, subkey, L"Version", type_lib_version, 1176 list->AddSetRegValueWorkItem(root, subkey, L"Version", type_lib_version,
1170 true); 1177 true);
1171 1178
1172 } else { 1179 } else {
1180 VLOG(1) << "Adding DelegateExecute verb handler COM unregistration items.";
gab 2012/04/25 14:59:05 Don't we want a slightly different log message for
grt (UTC plus 2) 2012/04/25 15:09:21 Moved "{,un}registration" closer to the front of t
1181
1173 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path); 1182 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path);
1174 list->AddDeleteRegKeyWorkItem(root, typelib_path); 1183 list->AddDeleteRegKeyWorkItem(root, typelib_path);
1175 list->AddDeleteRegKeyWorkItem(root, interface_path); 1184 list->AddDeleteRegKeyWorkItem(root, interface_path);
1176 } 1185 }
1177 } 1186 }
1178 1187
1179 namespace { 1188 namespace {
1180 1189
1181 enum ElevationPolicyId { 1190 enum ElevationPolicyId {
1182 CURRENT_ELEVATION_POLICY, 1191 CURRENT_ELEVATION_POLICY,
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 } else { 1425 } else {
1417 DCHECK(operation == REMOVE_COMMAND); 1426 DCHECK(operation == REMOVE_COMMAND);
1418 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), 1427 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(),
1419 cmd_key)->set_log_message( 1428 cmd_key)->set_log_message(
1420 "removing quick-enable-cf command"); 1429 "removing quick-enable-cf command");
1421 } 1430 }
1422 } 1431 }
1423 } 1432 }
1424 1433
1425 } // namespace installer 1434 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_worker.h ('k') | chrome/installer/setup/uninstall.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698