Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: chrome/installer/setup/install_worker.cc

Issue 11412015: Copy setup when quick-enabling app host to user-level from system-level. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments / move helpers to anonymous namespace. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/installer/setup/setup_main.cc » ('j') | chrome/installer/setup/uninstall.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 1083
1079 if (installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { 1084 if (installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) {
1080 install_list->AddCopyTreeWorkItem( 1085 install_list->AddCopyTreeWorkItem(
1081 src_path.Append(installer::kChromeAppHostExe).value(), 1086 src_path.Append(installer::kChromeAppHostExe).value(),
1082 target_path.Append(installer::kChromeAppHostExe).value(), 1087 target_path.Append(installer::kChromeAppHostExe).value(),
1083 temp_path.value(), 1088 temp_path.value(),
1084 WorkItem::ALWAYS, 1089 WorkItem::ALWAYS,
1085 L""); 1090 L"");
1086 } 1091 }
1087 1092
1093 // Copy installer in install directory
1094 AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path,
1095 new_version, install_list);
1096
1088 const HKEY root = installer_state.root_key(); 1097 const HKEY root = installer_state.root_key();
1089 // Only set "lang" for user-level installs since for system-level, the install 1098 // 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. 1099 // language may not be related to a given user's runtime language.
1091 const bool add_language_identifier = !installer_state.system_install(); 1100 const bool add_language_identifier = !installer_state.system_install();
1092 1101
1093 const Products& products = installer_state.products(); 1102 const Products& products = installer_state.products();
1094 for (Products::const_iterator it = products.begin(); it < products.end(); 1103 for (Products::const_iterator it = products.begin(); it < products.end();
1095 ++it) { 1104 ++it) {
1096 const Product& product = **it; 1105 const Product& product = **it;
1097 1106
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 // Log everything for now. 1622 // Log everything for now.
1614 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); 1623 cmd_line.AppendSwitch(installer::switches::kVerboseLogging);
1615 1624
1616 AppCommand cmd(cmd_line.GetCommandLineString()); 1625 AppCommand cmd(cmd_line.GetCommandLineString());
1617 cmd.set_is_auto_run_on_os_upgrade(true); 1626 cmd.set_is_auto_run_on_os_upgrade(true);
1618 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); 1627 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list);
1619 } 1628 }
1620 } 1629 }
1621 1630
1622 } // namespace installer 1631 } // namespace installer
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/setup/setup_main.cc » ('j') | chrome/installer/setup/uninstall.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698