OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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."; | 1083 VLOG(1) << "DelegateExecute verb handler COM registration."; |
1084 | 1084 |
1085 HKEY root = installer_state.root_key(); | 1085 HKEY root = installer_state.root_key(); |
1086 const bool is_install = | 1086 const bool is_install = |
1087 (installer_state.operation() != InstallerState::UNINSTALL); | 1087 (installer_state.operation() != InstallerState::UNINSTALL); |
1088 string16 delegate_execute_path(L"Software\\Classes\\CLSID\\"); | 1088 string16 delegate_execute_path(L"Software\\Classes\\CLSID\\"); |
1089 delegate_execute_path.append(handler_class_uuid); | 1089 delegate_execute_path.append(handler_class_uuid); |
1090 string16 typelib_path(L"Software\\Classes\\TypeLib\\"); | 1090 string16 typelib_path(L"Software\\Classes\\TypeLib\\"); |
1091 typelib_path.append(type_lib_uuid); | 1091 typelib_path.append(type_lib_uuid); |
1092 string16 interface_path(L"Software\\Classes\\Interface\\"); | 1092 string16 interface_path(L"Software\\Classes\\Interface\\"); |
1093 interface_path.append(interface_uuid); | 1093 interface_path.append(interface_uuid); |
1094 | 1094 |
1095 if (is_install) { | 1095 // Add work items to register the handler iff it is present. Remove its |
1096 // registration otherwise since builds after r132190 included it when it | |
1097 // wasn't strictly necessary. | |
1098 // TODO(grt): remove the extra check for the .exe when it's ever-present. | |
gab
2012/04/25 05:18:29
Actually, will all distributions have the .exe? If
grt (UTC plus 2)
2012/04/25 13:05:11
The check on line 1075 ensures that this is only h
gab
2012/04/25 13:44:02
Ah ok, perfect.
| |
1099 if (is_install && | |
1100 file_util::PathExists(src_path.AppendASCII(new_version.GetString()) | |
1101 .Append(kDelegateExecuteExe))) { | |
1096 // The path to the exe (in the version directory). | 1102 // The path to the exe (in the version directory). |
1097 FilePath delegate_execute( | 1103 FilePath delegate_execute( |
1098 installer_state.target_path().AppendASCII(new_version.GetString())); | 1104 installer_state.target_path().AppendASCII(new_version.GetString())); |
1099 delegate_execute = delegate_execute.Append(kDelegateExecuteExe); | 1105 delegate_execute = delegate_execute.Append(kDelegateExecuteExe); |
1100 | 1106 |
1101 // Command-line featuring the quoted path to the exe. | 1107 // Command-line featuring the quoted path to the exe. |
1102 string16 command(1, L'"'); | 1108 string16 command(1, L'"'); |
1103 command.append(delegate_execute.value()).append(1, L'"'); | 1109 command.append(delegate_execute.value()).append(1, L'"'); |
1104 | 1110 |
1105 // Register the CommandExecuteImpl class at | 1111 // Register the CommandExecuteImpl class at |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1416 } else { | 1422 } else { |
1417 DCHECK(operation == REMOVE_COMMAND); | 1423 DCHECK(operation == REMOVE_COMMAND); |
1418 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | 1424 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), |
1419 cmd_key)->set_log_message( | 1425 cmd_key)->set_log_message( |
1420 "removing quick-enable-cf command"); | 1426 "removing quick-enable-cf command"); |
1421 } | 1427 } |
1422 } | 1428 } |
1423 } | 1429 } |
1424 | 1430 |
1425 } // namespace installer | 1431 } // namespace installer |
OLD | NEW |