Chromium Code Reviews| 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 | 13 |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/file_path.h" | 17 #include "base/file_path.h" |
| 18 #include "base/file_util.h" | 18 #include "base/file_util.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 21 #include "base/string16.h" | |
| 21 #include "base/string_util.h" | 22 #include "base/string_util.h" |
| 22 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
| 23 #include "base/version.h" | 24 #include "base/version.h" |
| 24 #include "base/win/registry.h" | 25 #include "base/win/registry.h" |
| 25 #include "base/win/windows_version.h" | 26 #include "base/win/windows_version.h" |
| 26 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
| 27 #include "chrome/installer/setup/install.h" | 28 #include "chrome/installer/setup/install.h" |
| 28 #include "chrome/installer/setup/setup_constants.h" | 29 #include "chrome/installer/setup/setup_constants.h" |
| 30 #include "chrome/installer/setup/setup_util.h" | |
| 31 #include "chrome/installer/util/browser_distribution.h" | |
| 29 #include "chrome/installer/util/conditional_work_item_list.h" | 32 #include "chrome/installer/util/conditional_work_item_list.h" |
| 30 #include "chrome/installer/util/create_reg_key_work_item.h" | 33 #include "chrome/installer/util/create_reg_key_work_item.h" |
| 31 #include "chrome/installer/util/google_update_constants.h" | 34 #include "chrome/installer/util/google_update_constants.h" |
| 32 #include "chrome/installer/util/helper.h" | 35 #include "chrome/installer/util/helper.h" |
| 36 #include "chrome/installer/util/install_util.h" | |
| 33 #include "chrome/installer/util/installation_state.h" | 37 #include "chrome/installer/util/installation_state.h" |
| 34 #include "chrome/installer/util/installer_state.h" | 38 #include "chrome/installer/util/installer_state.h" |
| 35 #include "chrome/installer/util/install_util.h" | |
| 36 #include "chrome/installer/util/l10n_string_util.h" | 39 #include "chrome/installer/util/l10n_string_util.h" |
| 37 #include "chrome/installer/util/product.h" | 40 #include "chrome/installer/util/product.h" |
| 38 #include "chrome/installer/util/set_reg_value_work_item.h" | 41 #include "chrome/installer/util/set_reg_value_work_item.h" |
| 39 #include "chrome/installer/util/shell_util.h" | 42 #include "chrome/installer/util/shell_util.h" |
| 40 #include "chrome/installer/util/util_constants.h" | 43 #include "chrome/installer/util/util_constants.h" |
| 41 #include "chrome/installer/util/work_item_list.h" | 44 #include "chrome/installer/util/work_item_list.h" |
| 42 #include "chrome_frame/chrome_tab.h" | 45 #include "chrome_frame/chrome_tab.h" |
| 43 | 46 |
| 44 using base::win::RegKey; | 47 using base::win::RegKey; |
| 45 | 48 |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 850 const Product* product = products[i]; | 853 const Product* product = products[i]; |
| 851 | 854 |
| 852 AddUninstallShortcutWorkItems(installer_state, setup_path, new_version, | 855 AddUninstallShortcutWorkItems(installer_state, setup_path, new_version, |
| 853 install_list, *product); | 856 install_list, *product); |
| 854 | 857 |
| 855 AddVersionKeyWorkItems(root, product->distribution(), new_version, | 858 AddVersionKeyWorkItems(root, product->distribution(), new_version, |
| 856 add_language_identifier, install_list); | 859 add_language_identifier, install_list); |
| 857 | 860 |
| 858 AddDelegateExecuteWorkItems(installer_state, src_path, new_version, | 861 AddDelegateExecuteWorkItems(installer_state, src_path, new_version, |
| 859 *product, install_list); | 862 *product, install_list); |
| 863 | |
| 864 AddActiveSetupWorkItems(installer_state, new_version, *product, | |
| 865 install_list); | |
| 860 } | 866 } |
| 861 | 867 |
| 862 if (installer_state.is_multi_install()) { | 868 if (installer_state.is_multi_install()) { |
| 863 AddMultiUninstallWorkItems(installer_state, setup_path, new_version, | 869 AddMultiUninstallWorkItems(installer_state, setup_path, new_version, |
| 864 install_list); | 870 install_list); |
| 865 | 871 |
| 866 AddVersionKeyWorkItems(root, | 872 AddVersionKeyWorkItems(root, |
| 867 installer_state.multi_package_binaries_distribution(), new_version, | 873 installer_state.multi_package_binaries_distribution(), new_version, |
| 868 add_language_identifier, install_list); | 874 add_language_identifier, install_list); |
| 869 } | 875 } |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1178 | 1184 |
| 1179 } else { | 1185 } else { |
| 1180 VLOG(1) << "Adding unregistration items for DelegateExecute verb handler."; | 1186 VLOG(1) << "Adding unregistration items for DelegateExecute verb handler."; |
| 1181 | 1187 |
| 1182 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path); | 1188 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path); |
| 1183 list->AddDeleteRegKeyWorkItem(root, typelib_path); | 1189 list->AddDeleteRegKeyWorkItem(root, typelib_path); |
| 1184 list->AddDeleteRegKeyWorkItem(root, interface_path); | 1190 list->AddDeleteRegKeyWorkItem(root, interface_path); |
| 1185 } | 1191 } |
| 1186 } | 1192 } |
| 1187 | 1193 |
| 1194 void AddActiveSetupWorkItems(const InstallerState& installer_state, | |
| 1195 const Version& new_version, | |
| 1196 const Product& product, | |
| 1197 WorkItemList* list) { | |
| 1198 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); | |
| 1199 BrowserDistribution* distribution = product.distribution(); | |
| 1200 | |
| 1201 if (!product.is_chrome() || !installer_state.system_install()) { | |
| 1202 const char* install_level = | |
| 1203 installer_state.system_install() ? "system" : "user"; | |
| 1204 VLOG(1) << "No Active Setup processing to do for " << install_level | |
| 1205 << "-level " << distribution->GetAppShortCutName(); | |
| 1206 return; | |
| 1207 } | |
| 1208 | |
| 1209 const HKEY root = HKEY_LOCAL_MACHINE; | |
| 1210 const string16 active_setup_path(GetActiveSetupPath(distribution)); | |
| 1211 | |
| 1212 VLOG(1) << "Adding registration items for Active Setup."; | |
| 1213 list->AddCreateRegKeyWorkItem(root, active_setup_path); | |
| 1214 list->AddSetRegValueWorkItem(root, active_setup_path, L"", | |
| 1215 distribution->GetAppShortCutName(), true); | |
| 1216 | |
| 1217 CommandLine cmd(installer_state.GetInstallerDirectory(new_version). | |
| 1218 Append(installer::kSetupExe)); | |
| 1219 cmd.AppendSwitch(installer::switches::kConfigureUserSettings); | |
| 1220 cmd.AppendSwitch(installer::switches::kVerboseLogging); | |
| 1221 list->AddSetRegValueWorkItem(root, active_setup_path, L"StubPath", | |
| 1222 cmd.GetCommandLineString(), true); | |
| 1223 | |
| 1224 // TODO(grt): http://crbug.com/75152 Write a reference to a localized | |
| 1225 // resource. | |
| 1226 list->AddSetRegValueWorkItem(root, active_setup_path, L"Localized Name", | |
| 1227 distribution->GetAppShortCutName(), true); | |
| 1228 | |
| 1229 list->AddSetRegValueWorkItem(root, active_setup_path, L"IsInstalled", | |
| 1230 DWORD(1U), true); | |
|
tommi (sloooow) - chröme
2012/07/20 09:59:25
static_cast<DWORD>(1U). Is the cast actually nece
gab
2012/07/20 14:45:47
Done.
Yes the cast is necessary otherwise I get:
| |
| 1231 | |
| 1232 string16 comma_separated_version(ASCIIToUTF16(new_version.GetString())); | |
| 1233 ReplaceChars(comma_separated_version, L".", L",", &comma_separated_version); | |
| 1234 list->AddSetRegValueWorkItem(root, active_setup_path, L"Version", | |
| 1235 comma_separated_version, true); | |
| 1236 } | |
| 1237 | |
| 1188 namespace { | 1238 namespace { |
| 1189 | 1239 |
| 1190 enum ElevationPolicyId { | 1240 enum ElevationPolicyId { |
| 1191 CURRENT_ELEVATION_POLICY, | 1241 CURRENT_ELEVATION_POLICY, |
| 1192 OLD_ELEVATION_POLICY, | 1242 OLD_ELEVATION_POLICY, |
| 1193 }; | 1243 }; |
| 1194 | 1244 |
| 1195 // Although the UUID of the ChromeFrame class is used for the "current" value, | 1245 // Although the UUID of the ChromeFrame class is used for the "current" value, |
| 1196 // this is done only as a convenience; there is no need for the GUID of the Low | 1246 // this is done only as a convenience; there is no need for the GUID of the Low |
| 1197 // Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to | 1247 // Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1425 } else { | 1475 } else { |
| 1426 DCHECK(operation == REMOVE_COMMAND); | 1476 DCHECK(operation == REMOVE_COMMAND); |
| 1427 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | 1477 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), |
| 1428 cmd_key)->set_log_message( | 1478 cmd_key)->set_log_message( |
| 1429 "removing quick-enable-cf command"); | 1479 "removing quick-enable-cf command"); |
| 1430 } | 1480 } |
| 1431 } | 1481 } |
| 1432 } | 1482 } |
| 1433 | 1483 |
| 1434 } // namespace installer | 1484 } // namespace installer |
| OLD | NEW |