| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 const FilePath& setup_path, | 155 const FilePath& setup_path, |
| 156 const FilePath& archive_path, | 156 const FilePath& archive_path, |
| 157 const FilePath& temp_path, | 157 const FilePath& temp_path, |
| 158 const Version& new_version, | 158 const Version& new_version, |
| 159 WorkItemList* install_list) { | 159 WorkItemList* install_list) { |
| 160 DCHECK(install_list); | 160 DCHECK(install_list); |
| 161 FilePath installer_dir(installer_state.GetInstallerDirectory(new_version)); | 161 FilePath installer_dir(installer_state.GetInstallerDirectory(new_version)); |
| 162 install_list->AddCreateDirWorkItem(installer_dir); | 162 install_list->AddCreateDirWorkItem(installer_dir); |
| 163 | 163 |
| 164 FilePath exe_dst(installer_dir.Append(setup_path.BaseName())); | 164 FilePath exe_dst(installer_dir.Append(setup_path.BaseName())); |
| 165 FilePath archive_dst(installer_dir.Append(archive_path.BaseName())); | |
| 166 | 165 |
| 167 if (exe_dst != setup_path) { | 166 if (exe_dst != setup_path) { |
| 168 install_list->AddCopyTreeWorkItem(setup_path.value(), exe_dst.value(), | 167 install_list->AddCopyTreeWorkItem(setup_path.value(), exe_dst.value(), |
| 169 temp_path.value(), WorkItem::ALWAYS); | 168 temp_path.value(), WorkItem::ALWAYS); |
| 170 } | 169 } |
| 171 | 170 |
| 172 if (archive_path != archive_dst) { | 171 // If only the App Host (not even the Chrome Binaries) is being installed, |
| 173 // In the past, we copied rather than moved for system level installs so | 172 // this must be a user-level App Host piggybacking on system-level Chrome |
| 174 // that the permissions of %ProgramFiles% would be picked up. Now that | 173 // Binaries. Only setup.exe is required, and only for uninstall. |
| 175 // |temp_path| is in %ProgramFiles% for system level installs (and in | 174 if (installer_state.products().size() != 1 || |
| 176 // %LOCALAPPDATA% otherwise), there is no need to do this for the archive. | 175 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
| 177 // Setup.exe, on the other hand, is created elsewhere so it must always be | 176 FilePath archive_dst(installer_dir.Append(archive_path.BaseName())); |
| 178 // copied. | 177 if (archive_path != archive_dst) { |
| 178 // In the past, we copied rather than moved for system level installs so |
| 179 // that the permissions of %ProgramFiles% would be picked up. Now that |
| 180 // |temp_path| is in %ProgramFiles% for system level installs (and in |
| 181 // %LOCALAPPDATA% otherwise), there is no need to do this for the archive. |
| 182 // Setup.exe, on the other hand, is created elsewhere so it must always be |
| 183 // copied. |
| 179 #if !defined(COMPONENT_BUILD) | 184 #if !defined(COMPONENT_BUILD) |
| 180 install_list->AddMoveTreeWorkItem(archive_path.value(), archive_dst.value(), | 185 install_list->AddMoveTreeWorkItem(archive_path.value(), |
| 181 temp_path.value(), WorkItem::ALWAYS_MOVE); | 186 archive_dst.value(), |
| 187 temp_path.value(), |
| 188 WorkItem::ALWAYS_MOVE); |
| 182 #else // COMPONENT_BUILD | 189 #else // COMPONENT_BUILD |
| 183 // The archive is usually extracted in |temp_path| in which case we want to | 190 // The archive is usually extracted in |temp_path| in which case we want |
| 184 // move it as mentioned above; however in the component build, setup.exe | 191 // to move it as mentioned above; however in the component build, |
| 185 // uses chrome.7z directly from the build output, moving it means that | 192 // setup.exe uses chrome.7z directly from the build output, moving it |
| 186 // setup.exe cannot be run again without regenerating the archive, so copy | 193 // means that setup.exe cannot be run again without regenerating the |
| 187 // it instead in this case to save developer time. | 194 // archive, so copy it instead in this case to save developer time. |
| 188 install_list->AddCopyTreeWorkItem(archive_path.value(), archive_dst.value(), | 195 install_list->AddCopyTreeWorkItem(archive_path.value(), |
| 189 temp_path.value(), WorkItem::ALWAYS); | 196 archive_dst.value(), |
| 197 temp_path.value(), |
| 198 WorkItem::ALWAYS); |
| 190 #endif // COMPONENT_BUILD | 199 #endif // COMPONENT_BUILD |
| 200 } |
| 191 } | 201 } |
| 192 } | 202 } |
| 193 | 203 |
| 194 void AddInstallAppCommandWorkItems(const InstallerState& installer_state, | 204 void AddInstallAppCommandWorkItems(const InstallerState& installer_state, |
| 195 const InstallationState& machine_state, | 205 const InstallationState& machine_state, |
| 196 const FilePath& setup_path, | 206 const FilePath& setup_path, |
| 197 const Version& new_version, | 207 const Version& new_version, |
| 198 const Product& product, | 208 const Product& product, |
| 199 WorkItemList* work_item_list) { | 209 WorkItemList* work_item_list) { |
| 200 DCHECK(product.is_chrome_app_host()); | 210 DCHECK(product.is_chrome_app_host()); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 src_path.AppendASCII(new_version.GetString()).value(), | 412 src_path.AppendASCII(new_version.GetString()).value(), |
| 403 target_path.AppendASCII(new_version.GetString()).value(), | 413 target_path.AppendASCII(new_version.GetString()).value(), |
| 404 temp_path.value(), | 414 temp_path.value(), |
| 405 check_for_duplicates ? WorkItem::CHECK_DUPLICATES : | 415 check_for_duplicates ? WorkItem::CHECK_DUPLICATES : |
| 406 WorkItem::ALWAYS_MOVE); | 416 WorkItem::ALWAYS_MOVE); |
| 407 | 417 |
| 408 // Delete any old_chrome.exe if present (ignore failure if it's in use). | 418 // Delete any old_chrome.exe if present (ignore failure if it's in use). |
| 409 install_list->AddDeleteTreeWorkItem( | 419 install_list->AddDeleteTreeWorkItem( |
| 410 target_path.Append(installer::kChromeOldExe), temp_path)-> | 420 target_path.Append(installer::kChromeOldExe), temp_path)-> |
| 411 set_ignore_failure(true); | 421 set_ignore_failure(true); |
| 412 | |
| 413 // Copy installer in install directory and | |
| 414 // add shortcut in Control Panel->Add/Remove Programs. | |
| 415 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path, | |
| 416 new_version, install_list); | |
| 417 } | 422 } |
| 418 | 423 |
| 419 // Probes COM machinery to get an instance of delegate_execute.exe's | 424 // Probes COM machinery to get an instance of delegate_execute.exe's |
| 420 // CommandExecuteImpl class. This is required so that COM purges its cache of | 425 // CommandExecuteImpl class. This is required so that COM purges its cache of |
| 421 // the path to the binary, which changes on updates. This callback | 426 // the path to the binary, which changes on updates. This callback |
| 422 // unconditionally returns true since an install should not be aborted if the | 427 // unconditionally returns true since an install should not be aborted if the |
| 423 // probe fails. | 428 // probe fails. |
| 424 bool ProbeCommandExecuteCallback(const string16& command_execute_id, | 429 bool ProbeCommandExecuteCallback(const string16& command_execute_id, |
| 425 const CallbackWorkItem& work_item) { | 430 const CallbackWorkItem& work_item) { |
| 426 // Noop on rollback. | 431 // Noop on rollback. |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 | 1081 |
| 1077 if (installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { | 1082 if (installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
| 1078 install_list->AddCopyTreeWorkItem( | 1083 install_list->AddCopyTreeWorkItem( |
| 1079 src_path.Append(installer::kChromeAppHostExe).value(), | 1084 src_path.Append(installer::kChromeAppHostExe).value(), |
| 1080 target_path.Append(installer::kChromeAppHostExe).value(), | 1085 target_path.Append(installer::kChromeAppHostExe).value(), |
| 1081 temp_path.value(), | 1086 temp_path.value(), |
| 1082 WorkItem::ALWAYS, | 1087 WorkItem::ALWAYS, |
| 1083 L""); | 1088 L""); |
| 1084 } | 1089 } |
| 1085 | 1090 |
| 1091 // Copy installer in install directory |
| 1092 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path, |
| 1093 new_version, install_list); |
| 1094 |
| 1086 const HKEY root = installer_state.root_key(); | 1095 const HKEY root = installer_state.root_key(); |
| 1087 // Only set "lang" for user-level installs since for system-level, the install | 1096 // Only set "lang" for user-level installs since for system-level, the install |
| 1088 // language may not be related to a given user's runtime language. | 1097 // language may not be related to a given user's runtime language. |
| 1089 const bool add_language_identifier = !installer_state.system_install(); | 1098 const bool add_language_identifier = !installer_state.system_install(); |
| 1090 | 1099 |
| 1091 const Products& products = installer_state.products(); | 1100 const Products& products = installer_state.products(); |
| 1092 for (Products::const_iterator it = products.begin(); it < products.end(); | 1101 for (Products::const_iterator it = products.begin(); it < products.end(); |
| 1093 ++it) { | 1102 ++it) { |
| 1094 const Product& product = **it; | 1103 const Product& product = **it; |
| 1095 | 1104 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 // Log everything for now. | 1620 // Log everything for now. |
| 1612 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); | 1621 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); |
| 1613 | 1622 |
| 1614 AppCommand cmd(cmd_line.GetCommandLineString()); | 1623 AppCommand cmd(cmd_line.GetCommandLineString()); |
| 1615 cmd.set_is_auto_run_on_os_upgrade(true); | 1624 cmd.set_is_auto_run_on_os_upgrade(true); |
| 1616 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); | 1625 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); |
| 1617 } | 1626 } |
| 1618 } | 1627 } |
| 1619 | 1628 |
| 1620 } // namespace installer | 1629 } // namespace installer |
| OLD | NEW |