| 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> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/version.h" | 25 #include "base/version.h" |
| 26 #include "base/win/registry.h" | 26 #include "base/win/registry.h" |
| 27 #include "base/win/scoped_comptr.h" | 27 #include "base/win/scoped_comptr.h" |
| 28 #include "base/win/windows_version.h" | 28 #include "base/win/windows_version.h" |
| 29 #include "chrome/common/chrome_constants.h" | 29 #include "chrome/common/chrome_constants.h" |
| 30 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/installer/setup/install.h" | 31 #include "chrome/installer/setup/install.h" |
| 32 #include "chrome/installer/setup/setup_constants.h" | 32 #include "chrome/installer/setup/setup_constants.h" |
| 33 #include "chrome/installer/setup/setup_util.h" | 33 #include "chrome/installer/setup/setup_util.h" |
| 34 #include "chrome/installer/util/app_registration_data.h" |
| 34 #include "chrome/installer/util/browser_distribution.h" | 35 #include "chrome/installer/util/browser_distribution.h" |
| 35 #include "chrome/installer/util/callback_work_item.h" | 36 #include "chrome/installer/util/callback_work_item.h" |
| 36 #include "chrome/installer/util/conditional_work_item_list.h" | 37 #include "chrome/installer/util/conditional_work_item_list.h" |
| 37 #include "chrome/installer/util/create_reg_key_work_item.h" | 38 #include "chrome/installer/util/create_reg_key_work_item.h" |
| 38 #include "chrome/installer/util/firewall_manager_win.h" | 39 #include "chrome/installer/util/firewall_manager_win.h" |
| 39 #include "chrome/installer/util/google_update_constants.h" | 40 #include "chrome/installer/util/google_update_constants.h" |
| 40 #include "chrome/installer/util/helper.h" | 41 #include "chrome/installer/util/helper.h" |
| 41 #include "chrome/installer/util/install_util.h" | 42 #include "chrome/installer/util/install_util.h" |
| 42 #include "chrome/installer/util/installation_state.h" | 43 #include "chrome/installer/util/installation_state.h" |
| 43 #include "chrome/installer/util/installer_state.h" | 44 #include "chrome/installer/util/installer_state.h" |
| 44 #include "chrome/installer/util/l10n_string_util.h" | 45 #include "chrome/installer/util/l10n_string_util.h" |
| 45 #include "chrome/installer/util/product.h" | 46 #include "chrome/installer/util/product.h" |
| 46 #include "chrome/installer/util/set_reg_value_work_item.h" | 47 #include "chrome/installer/util/set_reg_value_work_item.h" |
| 47 #include "chrome/installer/util/shell_util.h" | 48 #include "chrome/installer/util/shell_util.h" |
| 49 #include "chrome/installer/util/updating_app_registration_data.h" |
| 48 #include "chrome/installer/util/util_constants.h" | 50 #include "chrome/installer/util/util_constants.h" |
| 49 #include "chrome/installer/util/work_item_list.h" | 51 #include "chrome/installer/util/work_item_list.h" |
| 50 | 52 |
| 51 using base::ASCIIToWide; | 53 using base::ASCIIToWide; |
| 52 using base::win::RegKey; | 54 using base::win::RegKey; |
| 53 | 55 |
| 54 namespace installer { | 56 namespace installer { |
| 55 | 57 |
| 56 namespace { | 58 namespace { |
| 57 | 59 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // system-level archive. | 180 // system-level archive. |
| 179 install_list->AddCopyTreeWorkItem(archive_path.value(), | 181 install_list->AddCopyTreeWorkItem(archive_path.value(), |
| 180 archive_dst.value(), | 182 archive_dst.value(), |
| 181 temp_path.value(), | 183 temp_path.value(), |
| 182 WorkItem::ALWAYS); | 184 WorkItem::ALWAYS); |
| 183 } | 185 } |
| 184 } | 186 } |
| 185 } | 187 } |
| 186 } | 188 } |
| 187 | 189 |
| 188 base::string16 GetRegCommandKey(BrowserDistribution* dist, | 190 base::string16 GetRegistrationDataCommandKey( |
| 189 const wchar_t* name) { | 191 const AppRegistrationData& reg_data, |
| 190 base::string16 cmd_key(dist->GetVersionKey()); | 192 const wchar_t* name) { |
| 193 base::string16 cmd_key(reg_data.GetVersionKey()); |
| 191 cmd_key.append(1, base::FilePath::kSeparators[0]) | 194 cmd_key.append(1, base::FilePath::kSeparators[0]) |
| 192 .append(google_update::kRegCommandsKey) | 195 .append(google_update::kRegCommandsKey) |
| 193 .append(1, base::FilePath::kSeparators[0]) | 196 .append(1, base::FilePath::kSeparators[0]) |
| 194 .append(name); | 197 .append(name); |
| 195 return cmd_key; | 198 return cmd_key; |
| 196 } | 199 } |
| 197 | 200 |
| 201 base::string16 GetRegCommandKey(BrowserDistribution* dist, |
| 202 const wchar_t* name) { |
| 203 return GetRegistrationDataCommandKey(dist->GetAppRegistrationData(), name); |
| 204 } |
| 205 |
| 198 // Adds work items to create (or delete if uninstalling) app commands to launch | 206 // Adds work items to create (or delete if uninstalling) app commands to launch |
| 199 // the app with a switch. The following criteria should be true: | 207 // the app with a switch. The following criteria should be true: |
| 200 // 1. The switch takes one parameter. | 208 // 1. The switch takes one parameter. |
| 201 // 2. The command send pings. | 209 // 2. The command send pings. |
| 202 // 3. The command is web accessible. | 210 // 3. The command is web accessible. |
| 203 // 4. The command is run as the user. | 211 // 4. The command is run as the user. |
| 204 void AddCommandWithParameterWorkItems(const InstallerState& installer_state, | 212 void AddCommandWithParameterWorkItems(const InstallerState& installer_state, |
| 205 const InstallationState& machine_state, | 213 const InstallationState& machine_state, |
| 206 const Version& new_version, | 214 const Version& new_version, |
| 207 const Product& product, | 215 const Product& product, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 229 | 237 |
| 230 AppCommand cmd(cmd_line.GetCommandLineString()); | 238 AppCommand cmd(cmd_line.GetCommandLineString()); |
| 231 cmd.set_sends_pings(true); | 239 cmd.set_sends_pings(true); |
| 232 cmd.set_is_web_accessible(true); | 240 cmd.set_is_web_accessible(true); |
| 233 cmd.set_is_run_as_user(true); | 241 cmd.set_is_run_as_user(true); |
| 234 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list); | 242 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list); |
| 235 } | 243 } |
| 236 } | 244 } |
| 237 | 245 |
| 238 void AddLegacyAppCommandRemovalItem(const InstallerState& installer_state, | 246 void AddLegacyAppCommandRemovalItem(const InstallerState& installer_state, |
| 239 BrowserDistribution* distribution, | 247 const AppRegistrationData& reg_data, |
| 240 const wchar_t* name, | 248 const wchar_t* name, |
| 241 WorkItemList* work_item_list) { | 249 WorkItemList* work_item_list) { |
| 242 // These failures are ignored because this is a clean-up operation that | 250 // These failures are ignored because this is a clean-up operation that |
| 243 // shouldn't block an install or update on failing. | 251 // shouldn't block an install or update on failing. |
| 244 work_item_list->AddDeleteRegKeyWorkItem( | 252 work_item_list->AddDeleteRegKeyWorkItem( |
| 245 installer_state.root_key(), | 253 installer_state.root_key(), |
| 246 GetRegCommandKey(distribution, name), | 254 GetRegistrationDataCommandKey(reg_data, name), |
| 247 KEY_WOW64_32KEY)->set_ignore_failure(true); | 255 KEY_WOW64_32KEY)->set_ignore_failure(true); |
| 248 } | 256 } |
| 249 | 257 |
| 250 // A callback invoked by |work_item| that adds firewall rules for Chrome. Rules | 258 // A callback invoked by |work_item| that adds firewall rules for Chrome. Rules |
| 251 // are left in-place on rollback unless |remove_on_rollback| is true. This is | 259 // are left in-place on rollback unless |remove_on_rollback| is true. This is |
| 252 // the case for new installs only. Updates and overinstalls leave the rule | 260 // the case for new installs only. Updates and overinstalls leave the rule |
| 253 // in-place on rollback since a previous install of Chrome will be used in that | 261 // in-place on rollback since a previous install of Chrome will be used in that |
| 254 // case. | 262 // case. |
| 255 bool AddFirewallRulesCallback(bool system_level, | 263 bool AddFirewallRulesCallback(bool system_level, |
| 256 BrowserDistribution* dist, | 264 BrowserDistribution* dist, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 const Products& products = installer_state.products(); | 398 const Products& products = installer_state.products(); |
| 391 for (Products::const_iterator it = products.begin(); it < products.end(); | 399 for (Products::const_iterator it = products.begin(); it < products.end(); |
| 392 ++it) { | 400 ++it) { |
| 393 const Product& p = **it; | 401 const Product& p = **it; |
| 394 if (p.is_chrome()) { | 402 if (p.is_chrome()) { |
| 395 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p, | 403 AddOsUpgradeWorkItems(installer_state, setup_path, new_version, p, |
| 396 list); | 404 list); |
| 397 AddFirewallRulesWorkItems( | 405 AddFirewallRulesWorkItems( |
| 398 installer_state, p.distribution(), is_new_install, list); | 406 installer_state, p.distribution(), is_new_install, list); |
| 399 AddLegacyAppCommandRemovalItem( | 407 AddLegacyAppCommandRemovalItem( |
| 400 installer_state, p.distribution(), kLegacyCmdInstallExtension, list); | 408 installer_state, |
| 409 p.distribution()->GetAppRegistrationData(), |
| 410 kLegacyCmdInstallExtension, |
| 411 list); |
| 401 | 412 |
| 402 if (p.distribution()->AppHostIsSupported()) { | 413 if (p.distribution()->AppHostIsSupported()) { |
| 403 // Unconditionally remove the "install-application" command from the app | 414 // Unconditionally remove the "install-application" command from the app |
| 404 // hosts's key. | 415 // hosts's key. |
| 405 AddLegacyAppCommandRemovalItem( | 416 UpdatingAppRegistrationData app_launcher_reg_data( |
| 406 installer_state, | 417 installer::kAppLauncherGuid); |
| 407 BrowserDistribution::GetSpecificDistribution( | 418 AddLegacyAppCommandRemovalItem(installer_state, app_launcher_reg_data, |
| 408 BrowserDistribution::CHROME_APP_HOST), | 419 kLegacyCmdInstallApp, list); |
| 409 kLegacyCmdInstallApp, | |
| 410 list); | |
| 411 } | 420 } |
| 412 } | 421 } |
| 413 if (p.is_chrome_binaries()) { | 422 if (p.is_chrome_binaries()) { |
| 414 AddQueryEULAAcceptanceWorkItems( | 423 AddQueryEULAAcceptanceWorkItems( |
| 415 installer_state, setup_path, new_version, p, list); | 424 installer_state, setup_path, new_version, p, list); |
| 416 AddQuickEnableChromeFrameWorkItems(installer_state, list); | 425 AddQuickEnableChromeFrameWorkItems(installer_state, list); |
| 417 AddQuickEnableApplicationLauncherWorkItems( | 426 AddQuickEnableApplicationLauncherWorkItems( |
| 418 installer_state, original_state, setup_path, new_version, list); | 427 installer_state, original_state, setup_path, new_version, list); |
| 419 } | 428 } |
| 420 } | 429 } |
| (...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 // Unconditionally remove the legacy Quick Enable command from the binaries. | 1664 // Unconditionally remove the legacy Quick Enable command from the binaries. |
| 1656 // Do this even if multi-install Chrome isn't installed to ensure that it is | 1665 // Do this even if multi-install Chrome isn't installed to ensure that it is |
| 1657 // not left behind in any case. | 1666 // not left behind in any case. |
| 1658 work_item_list->AddDeleteRegKeyWorkItem( | 1667 work_item_list->AddDeleteRegKeyWorkItem( |
| 1659 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) | 1668 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) |
| 1660 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + | 1669 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + |
| 1661 " command"); | 1670 " command"); |
| 1662 } | 1671 } |
| 1663 | 1672 |
| 1664 } // namespace installer | 1673 } // namespace installer |
| OLD | NEW |