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