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