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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 165 |
166 if (exe_dst != setup_path) { | 166 if (exe_dst != setup_path) { |
167 install_list->AddCopyTreeWorkItem(setup_path.value(), exe_dst.value(), | 167 install_list->AddCopyTreeWorkItem(setup_path.value(), exe_dst.value(), |
168 temp_path.value(), WorkItem::ALWAYS); | 168 temp_path.value(), WorkItem::ALWAYS); |
169 } | 169 } |
170 | 170 |
| 171 if (installer_state.RequiresActiveSetup()) { |
| 172 // Make a copy of setup.exe with a different name so that Active Setup |
| 173 // doesn't require an admin on XP thanks to Application Compatibility. |
| 174 FilePath active_setup_exe(installer_dir.Append(kActiveSetupExe)); |
| 175 install_list->AddCopyTreeWorkItem( |
| 176 setup_path.value(), active_setup_exe.value(), temp_path.value(), |
| 177 WorkItem::ALWAYS); |
| 178 } |
| 179 |
171 // If only the App Host (not even the Chrome Binaries) is being installed, | 180 // If only the App Host (not even the Chrome Binaries) is being installed, |
172 // this must be a user-level App Host piggybacking on system-level Chrome | 181 // this must be a user-level App Host piggybacking on system-level Chrome |
173 // Binaries. Only setup.exe is required, and only for uninstall. | 182 // Binaries. Only setup.exe is required, and only for uninstall. |
174 if (installer_state.products().size() != 1 || | 183 if (installer_state.products().size() != 1 || |
175 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { | 184 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
176 FilePath archive_dst(installer_dir.Append(archive_path.BaseName())); | 185 FilePath archive_dst(installer_dir.Append(archive_path.BaseName())); |
177 if (archive_path != archive_dst) { | 186 if (archive_path != archive_dst) { |
178 // In the past, we copied rather than moved for system level installs so | 187 // 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 | 188 // that the permissions of %ProgramFiles% would be picked up. Now that |
180 // |temp_path| is in %ProgramFiles% for system level installs (and in | 189 // |temp_path| is in %ProgramFiles% for system level installs (and in |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); | 1402 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); |
1394 BrowserDistribution* distribution = product.distribution(); | 1403 BrowserDistribution* distribution = product.distribution(); |
1395 | 1404 |
1396 if (!product.is_chrome() || !installer_state.system_install()) { | 1405 if (!product.is_chrome() || !installer_state.system_install()) { |
1397 const char* install_level = | 1406 const char* install_level = |
1398 installer_state.system_install() ? "system" : "user"; | 1407 installer_state.system_install() ? "system" : "user"; |
1399 VLOG(1) << "No Active Setup processing to do for " << install_level | 1408 VLOG(1) << "No Active Setup processing to do for " << install_level |
1400 << "-level " << distribution->GetAppShortCutName(); | 1409 << "-level " << distribution->GetAppShortCutName(); |
1401 return; | 1410 return; |
1402 } | 1411 } |
| 1412 DCHECK(installer_state.RequiresActiveSetup()); |
1403 | 1413 |
1404 const HKEY root = HKEY_LOCAL_MACHINE; | 1414 const HKEY root = HKEY_LOCAL_MACHINE; |
1405 const string16 active_setup_path( | 1415 const string16 active_setup_path( |
1406 InstallUtil::GetActiveSetupPath(distribution)); | 1416 InstallUtil::GetActiveSetupPath(distribution)); |
1407 | 1417 |
1408 VLOG(1) << "Adding registration items for Active Setup."; | 1418 VLOG(1) << "Adding registration items for Active Setup."; |
1409 list->AddCreateRegKeyWorkItem(root, active_setup_path); | 1419 list->AddCreateRegKeyWorkItem(root, active_setup_path); |
1410 list->AddSetRegValueWorkItem(root, active_setup_path, L"", | 1420 list->AddSetRegValueWorkItem(root, active_setup_path, L"", |
1411 distribution->GetAppShortCutName(), true); | 1421 distribution->GetAppShortCutName(), true); |
1412 | 1422 |
1413 CommandLine cmd(installer_state.GetInstallerDirectory(new_version). | 1423 FilePath active_setup_exe(installer_state.GetInstallerDirectory(new_version) |
1414 Append(setup_path.BaseName())); | 1424 .Append(kActiveSetupExe)); |
| 1425 CommandLine cmd(active_setup_exe); |
1415 cmd.AppendSwitch(installer::switches::kConfigureUserSettings); | 1426 cmd.AppendSwitch(installer::switches::kConfigureUserSettings); |
1416 cmd.AppendSwitch(installer::switches::kVerboseLogging); | 1427 cmd.AppendSwitch(installer::switches::kVerboseLogging); |
1417 cmd.AppendSwitch(installer::switches::kSystemLevel); | 1428 cmd.AppendSwitch(installer::switches::kSystemLevel); |
1418 product.AppendProductFlags(&cmd); | 1429 product.AppendProductFlags(&cmd); |
1419 list->AddSetRegValueWorkItem(root, active_setup_path, L"StubPath", | 1430 list->AddSetRegValueWorkItem(root, active_setup_path, L"StubPath", |
1420 cmd.GetCommandLineString(), true); | 1431 cmd.GetCommandLineString(), true); |
1421 | 1432 |
1422 // TODO(grt): http://crbug.com/75152 Write a reference to a localized | 1433 // TODO(grt): http://crbug.com/75152 Write a reference to a localized |
1423 // resource. | 1434 // resource. |
1424 list->AddSetRegValueWorkItem(root, active_setup_path, L"Localized Name", | 1435 list->AddSetRegValueWorkItem(root, active_setup_path, L"Localized Name", |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 // Log everything for now. | 1631 // Log everything for now. |
1621 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); | 1632 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); |
1622 | 1633 |
1623 AppCommand cmd(cmd_line.GetCommandLineString()); | 1634 AppCommand cmd(cmd_line.GetCommandLineString()); |
1624 cmd.set_is_auto_run_on_os_upgrade(true); | 1635 cmd.set_is_auto_run_on_os_upgrade(true); |
1625 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); | 1636 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); |
1626 } | 1637 } |
1627 } | 1638 } |
1628 | 1639 |
1629 } // namespace installer | 1640 } // namespace installer |
OLD | NEW |