| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 DCHECK(command_key); | 238 DCHECK(command_key); |
| 239 DCHECK(app); | 239 DCHECK(app); |
| 240 DCHECK(command_with_parameter); | 240 DCHECK(command_with_parameter); |
| 241 DCHECK(work_item_list); | 241 DCHECK(work_item_list); |
| 242 | 242 |
| 243 string16 full_cmd_key(GetRegCommandKey(product.distribution(), command_key)); | 243 string16 full_cmd_key(GetRegCommandKey(product.distribution(), command_key)); |
| 244 | 244 |
| 245 if (installer_state.operation() == InstallerState::UNINSTALL) { | 245 if (installer_state.operation() == InstallerState::UNINSTALL) { |
| 246 work_item_list->AddDeleteRegKeyWorkItem( | 246 work_item_list->AddDeleteRegKeyWorkItem( |
| 247 installer_state.root_key(), full_cmd_key)->set_log_message( | 247 installer_state.root_key(), full_cmd_key)->set_log_message( |
| 248 "removing " + WideToASCII(command_key) + " command"); | 248 "removing " + base::WideToASCII(command_key) + " command"); |
| 249 } else { | 249 } else { |
| 250 CommandLine cmd_line(installer_state.target_path().Append(app)); | 250 CommandLine cmd_line(installer_state.target_path().Append(app)); |
| 251 cmd_line.AppendSwitchASCII(command_with_parameter, "%1"); | 251 cmd_line.AppendSwitchASCII(command_with_parameter, "%1"); |
| 252 | 252 |
| 253 AppCommand cmd(cmd_line.GetCommandLineString()); | 253 AppCommand cmd(cmd_line.GetCommandLineString()); |
| 254 cmd.set_sends_pings(true); | 254 cmd.set_sends_pings(true); |
| 255 cmd.set_is_web_accessible(true); | 255 cmd.set_is_web_accessible(true); |
| 256 cmd.set_is_run_as_user(true); | 256 cmd.set_is_run_as_user(true); |
| 257 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list); | 257 cmd.AddWorkItems(installer_state.root_key(), full_cmd_key, work_item_list); |
| 258 } | 258 } |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 L"NoModify", static_cast<DWORD>(1), | 743 L"NoModify", static_cast<DWORD>(1), |
| 744 true); | 744 true); |
| 745 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 745 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
| 746 L"NoRepair", static_cast<DWORD>(1), | 746 L"NoRepair", static_cast<DWORD>(1), |
| 747 true); | 747 true); |
| 748 | 748 |
| 749 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 749 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
| 750 L"Publisher", | 750 L"Publisher", |
| 751 browser_dist->GetPublisherName(), | 751 browser_dist->GetPublisherName(), |
| 752 true); | 752 true); |
| 753 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 753 install_list->AddSetRegValueWorkItem( |
| 754 L"Version", | 754 reg_root, uninstall_reg, |
| 755 ASCIIToWide(new_version.GetString()), | 755 L"Version", |
| 756 true); | 756 base::ASCIIToWide(new_version.GetString()), |
| 757 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 757 true); |
| 758 L"DisplayVersion", | 758 install_list->AddSetRegValueWorkItem( |
| 759 ASCIIToWide(new_version.GetString()), | 759 reg_root, uninstall_reg, |
| 760 true); | 760 L"DisplayVersion", |
| 761 base::ASCIIToWide(new_version.GetString()), |
| 762 true); |
| 761 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 763 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
| 762 L"InstallDate", | 764 L"InstallDate", |
| 763 InstallUtil::GetCurrentDate(), | 765 InstallUtil::GetCurrentDate(), |
| 764 false); | 766 false); |
| 765 | 767 |
| 766 const std::vector<uint16>& version_components = new_version.components(); | 768 const std::vector<uint16>& version_components = new_version.components(); |
| 767 if (version_components.size() == 4) { | 769 if (version_components.size() == 4) { |
| 768 // Our version should be in major.minor.build.rev. | 770 // Our version should be in major.minor.build.rev. |
| 769 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 771 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
| 770 L"VersionMajor", static_cast<DWORD>(version_components[2]), true); | 772 L"VersionMajor", static_cast<DWORD>(version_components[2]), true); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 799 // exception: what Chrome calls "en-us", Omaha calls "en". sigh. | 801 // exception: what Chrome calls "en-us", Omaha calls "en". sigh. |
| 800 string16 language(GetCurrentTranslation()); | 802 string16 language(GetCurrentTranslation()); |
| 801 if (LowerCaseEqualsASCII(language, "en-us")) | 803 if (LowerCaseEqualsASCII(language, "en-us")) |
| 802 language.resize(2); | 804 language.resize(2); |
| 803 list->AddSetRegValueWorkItem(root, version_key, | 805 list->AddSetRegValueWorkItem(root, version_key, |
| 804 google_update::kRegLangField, language, | 806 google_update::kRegLangField, language, |
| 805 false); // do not overwrite language | 807 false); // do not overwrite language |
| 806 } | 808 } |
| 807 list->AddSetRegValueWorkItem(root, version_key, | 809 list->AddSetRegValueWorkItem(root, version_key, |
| 808 google_update::kRegVersionField, | 810 google_update::kRegVersionField, |
| 809 ASCIIToWide(new_version.GetString()), | 811 base::ASCIIToWide(new_version.GetString()), |
| 810 true); // overwrite version | 812 true); // overwrite version |
| 811 } | 813 } |
| 812 | 814 |
| 813 // Mirror oeminstall the first time anything is installed multi. There is no | 815 // Mirror oeminstall the first time anything is installed multi. There is no |
| 814 // need to update the value on future install/update runs since this value never | 816 // need to update the value on future install/update runs since this value never |
| 815 // changes. Note that the value is removed by Google Update after EULA | 817 // changes. Note that the value is removed by Google Update after EULA |
| 816 // acceptance is processed. | 818 // acceptance is processed. |
| 817 void AddOemInstallWorkItems(const InstallationState& original_state, | 819 void AddOemInstallWorkItems(const InstallationState& original_state, |
| 818 const InstallerState& installer_state, | 820 const InstallerState& installer_state, |
| 819 WorkItemList* install_list) { | 821 WorkItemList* install_list) { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 rename.AppendSwitch(switches::kVerboseLogging); | 1065 rename.AppendSwitch(switches::kVerboseLogging); |
| 1064 | 1066 |
| 1065 string16 version_key; | 1067 string16 version_key; |
| 1066 for (size_t i = 0; i < products.size(); ++i) { | 1068 for (size_t i = 0; i < products.size(); ++i) { |
| 1067 BrowserDistribution* dist = products[i]->distribution(); | 1069 BrowserDistribution* dist = products[i]->distribution(); |
| 1068 version_key = dist->GetVersionKey(); | 1070 version_key = dist->GetVersionKey(); |
| 1069 | 1071 |
| 1070 if (current_version) { | 1072 if (current_version) { |
| 1071 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, | 1073 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, |
| 1072 google_update::kRegOldVersionField, | 1074 google_update::kRegOldVersionField, |
| 1073 ASCIIToWide(current_version->GetString()), true); | 1075 base::ASCIIToWide(current_version->GetString()), true); |
| 1074 } | 1076 } |
| 1075 if (critical_version.IsValid()) { | 1077 if (critical_version.IsValid()) { |
| 1076 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, | 1078 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, |
| 1077 google_update::kRegCriticalVersionField, | 1079 google_update::kRegCriticalVersionField, |
| 1078 ASCIIToWide(critical_version.GetString()), true); | 1080 base::ASCIIToWide(critical_version.GetString()), true); |
| 1079 } else { | 1081 } else { |
| 1080 in_use_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 1082 in_use_update_work_items->AddDeleteRegValueWorkItem(root, version_key, |
| 1081 google_update::kRegCriticalVersionField); | 1083 google_update::kRegCriticalVersionField); |
| 1082 } | 1084 } |
| 1083 | 1085 |
| 1084 // Adding this registry entry for all products (but the binaries) is | 1086 // Adding this registry entry for all products (but the binaries) is |
| 1085 // overkill. However, as it stands, we don't have a way to know which | 1087 // overkill. However, as it stands, we don't have a way to know which |
| 1086 // product will check the key and run the command, so we add it for all. | 1088 // product will check the key and run the command, so we add it for all. |
| 1087 // The first to run it will perform the operation and clean up the other | 1089 // The first to run it will perform the operation and clean up the other |
| 1088 // values. | 1090 // values. |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1675 BrowserDistribution::GetSpecificDistribution( | 1677 BrowserDistribution::GetSpecificDistribution( |
| 1676 BrowserDistribution::CHROME_BINARIES), | 1678 BrowserDistribution::CHROME_BINARIES), |
| 1677 kCmdQuickEnableCf)); | 1679 kCmdQuickEnableCf)); |
| 1678 | 1680 |
| 1679 if (will_have_chrome_frame) { | 1681 if (will_have_chrome_frame) { |
| 1680 // Chrome Frame is (to be) installed. Unconditionally remove the Quick | 1682 // Chrome Frame is (to be) installed. Unconditionally remove the Quick |
| 1681 // Enable command from the binaries. We do this even if multi-install Chrome | 1683 // Enable command from the binaries. We do this even if multi-install Chrome |
| 1682 // isn't installed since we don't want them left behind in any case. | 1684 // isn't installed since we don't want them left behind in any case. |
| 1683 work_item_list->AddDeleteRegKeyWorkItem( | 1685 work_item_list->AddDeleteRegKeyWorkItem( |
| 1684 installer_state.root_key(), cmd_key)->set_log_message( | 1686 installer_state.root_key(), cmd_key)->set_log_message( |
| 1685 "removing " + WideToASCII(kCmdQuickEnableCf) + " command"); | 1687 "removing " + base::WideToASCII(kCmdQuickEnableCf) + " command"); |
| 1686 | 1688 |
| 1687 } else if (will_have_chrome_binaries) { | 1689 } else if (will_have_chrome_binaries) { |
| 1688 // Chrome Frame isn't (to be) installed while some other multi-install | 1690 // Chrome Frame isn't (to be) installed while some other multi-install |
| 1689 // product is (to be) installed. Add the Quick Enable command to | 1691 // product is (to be) installed. Add the Quick Enable command to |
| 1690 // the binaries. | 1692 // the binaries. |
| 1691 CommandLine cmd_line(GetGenericQuickEnableCommand(installer_state, | 1693 CommandLine cmd_line(GetGenericQuickEnableCommand(installer_state, |
| 1692 machine_state, | 1694 machine_state, |
| 1693 setup_path, | 1695 setup_path, |
| 1694 new_version)); | 1696 new_version)); |
| 1695 // kMultiInstall and kVerboseLogging were processed above. | 1697 // kMultiInstall and kVerboseLogging were processed above. |
| 1696 cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable); | 1698 cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable); |
| 1697 if (installer_state.system_install()) | 1699 if (installer_state.system_install()) |
| 1698 cmd_line.AppendSwitch(switches::kSystemLevel); | 1700 cmd_line.AppendSwitch(switches::kSystemLevel); |
| 1699 AppCommand cmd(cmd_line.GetCommandLineString()); | 1701 AppCommand cmd(cmd_line.GetCommandLineString()); |
| 1700 cmd.set_sends_pings(true); | 1702 cmd.set_sends_pings(true); |
| 1701 cmd.set_is_web_accessible(true); | 1703 cmd.set_is_web_accessible(true); |
| 1702 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); | 1704 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); |
| 1703 } | 1705 } |
| 1704 } | 1706 } |
| 1705 | 1707 |
| 1706 } // namespace installer | 1708 } // namespace installer |
| OLD | NEW |