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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 int len = StringFromGUID2(__uuidof(ChromeFrame), &cf_clsid[0], | 101 int len = StringFromGUID2(__uuidof(ChromeFrame), &cf_clsid[0], |
102 arraysize(cf_clsid)); | 102 arraysize(cf_clsid)); |
103 key_path->append(&cf_clsid[0], len - 1); | 103 key_path->append(&cf_clsid[0], len - 1); |
104 #endif | 104 #endif |
105 } else { | 105 } else { |
106 key_path->append(kIELowRightsPolicyOldGuid, | 106 key_path->append(kIELowRightsPolicyOldGuid, |
107 arraysize(kIELowRightsPolicyOldGuid)- 1); | 107 arraysize(kIELowRightsPolicyOldGuid)- 1); |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 // Returns true if this install (as described by |installer_state|) requires | |
112 // Active Setup. | |
113 bool RequiresActiveSetup(const InstallerState& installer_state) { | |
grt (UTC plus 2)
2013/01/09 18:57:45
did you consider making this a method on Installer
gab
2013/01/09 19:35:10
Arg...! Sorry for wasting your time, this is what
| |
114 return (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) && | |
115 installer_state.system_install()); | |
116 } | |
117 | |
111 // Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of | 118 // Local helper to call AddRegisterComDllWorkItems for all DLLs in a set of |
112 // products managed by a given package. | 119 // products managed by a given package. |
113 // |old_version| can be NULL to indicate no Chrome is currently installed. | 120 // |old_version| can be NULL to indicate no Chrome is currently installed. |
114 void AddRegisterComDllWorkItemsForPackage(const InstallerState& installer_state, | 121 void AddRegisterComDllWorkItemsForPackage(const InstallerState& installer_state, |
115 const Version* old_version, | 122 const Version* old_version, |
116 const Version& new_version, | 123 const Version& new_version, |
117 WorkItemList* work_item_list) { | 124 WorkItemList* work_item_list) { |
118 // First collect the list of DLLs to be registered from each product. | 125 // First collect the list of DLLs to be registered from each product. |
119 std::vector<FilePath> com_dll_list; | 126 std::vector<FilePath> com_dll_list; |
120 installer_state.AddComDllList(&com_dll_list); | 127 installer_state.AddComDllList(&com_dll_list); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 FilePath installer_dir(installer_state.GetInstallerDirectory(new_version)); | 168 FilePath installer_dir(installer_state.GetInstallerDirectory(new_version)); |
162 install_list->AddCreateDirWorkItem(installer_dir); | 169 install_list->AddCreateDirWorkItem(installer_dir); |
163 | 170 |
164 FilePath exe_dst(installer_dir.Append(setup_path.BaseName())); | 171 FilePath exe_dst(installer_dir.Append(setup_path.BaseName())); |
165 | 172 |
166 if (exe_dst != setup_path) { | 173 if (exe_dst != setup_path) { |
167 install_list->AddCopyTreeWorkItem(setup_path.value(), exe_dst.value(), | 174 install_list->AddCopyTreeWorkItem(setup_path.value(), exe_dst.value(), |
168 temp_path.value(), WorkItem::ALWAYS); | 175 temp_path.value(), WorkItem::ALWAYS); |
169 } | 176 } |
170 | 177 |
178 if (RequiresActiveSetup(installer_state)) { | |
179 FilePath active_setup_exe(installer_dir.Append(kActiveSetupExe)); | |
grt (UTC plus 2)
2013/01/09 18:57:45
suggested comment:
// Make a copy of setup.exe
gab
2013/01/09 19:35:10
Done.
| |
180 install_list->AddCopyTreeWorkItem( | |
181 setup_path.value(), active_setup_exe.value(), temp_path.value(), | |
182 WorkItem::ALWAYS); | |
183 } | |
184 | |
171 // If only the App Host (not even the Chrome Binaries) is being installed, | 185 // 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 | 186 // this must be a user-level App Host piggybacking on system-level Chrome |
173 // Binaries. Only setup.exe is required, and only for uninstall. | 187 // Binaries. Only setup.exe is required, and only for uninstall. |
174 if (installer_state.products().size() != 1 || | 188 if (installer_state.products().size() != 1 || |
175 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { | 189 !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
176 FilePath archive_dst(installer_dir.Append(archive_path.BaseName())); | 190 FilePath archive_dst(installer_dir.Append(archive_path.BaseName())); |
177 if (archive_path != archive_dst) { | 191 if (archive_path != archive_dst) { |
178 // In the past, we copied rather than moved for system level installs so | 192 // 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 | 193 // that the permissions of %ProgramFiles% would be picked up. Now that |
180 // |temp_path| is in %ProgramFiles% for system level installs (and in | 194 // |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); | 1407 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); |
1394 BrowserDistribution* distribution = product.distribution(); | 1408 BrowserDistribution* distribution = product.distribution(); |
1395 | 1409 |
1396 if (!product.is_chrome() || !installer_state.system_install()) { | 1410 if (!product.is_chrome() || !installer_state.system_install()) { |
1397 const char* install_level = | 1411 const char* install_level = |
1398 installer_state.system_install() ? "system" : "user"; | 1412 installer_state.system_install() ? "system" : "user"; |
1399 VLOG(1) << "No Active Setup processing to do for " << install_level | 1413 VLOG(1) << "No Active Setup processing to do for " << install_level |
1400 << "-level " << distribution->GetAppShortCutName(); | 1414 << "-level " << distribution->GetAppShortCutName(); |
1401 return; | 1415 return; |
1402 } | 1416 } |
1417 DCHECK(RequiresActiveSetup(installer_state)); | |
robertshield
2013/01/09 18:53:14
Doesn't this check duplicate that done in the if s
gab
2013/01/09 18:56:35
Right, but as discussed with Greg, putting it here
| |
1403 | 1418 |
1404 const HKEY root = HKEY_LOCAL_MACHINE; | 1419 const HKEY root = HKEY_LOCAL_MACHINE; |
1405 const string16 active_setup_path( | 1420 const string16 active_setup_path( |
1406 InstallUtil::GetActiveSetupPath(distribution)); | 1421 InstallUtil::GetActiveSetupPath(distribution)); |
1407 | 1422 |
1408 VLOG(1) << "Adding registration items for Active Setup."; | 1423 VLOG(1) << "Adding registration items for Active Setup."; |
1409 list->AddCreateRegKeyWorkItem(root, active_setup_path); | 1424 list->AddCreateRegKeyWorkItem(root, active_setup_path); |
1410 list->AddSetRegValueWorkItem(root, active_setup_path, L"", | 1425 list->AddSetRegValueWorkItem(root, active_setup_path, L"", |
1411 distribution->GetAppShortCutName(), true); | 1426 distribution->GetAppShortCutName(), true); |
1412 | 1427 |
1413 CommandLine cmd(installer_state.GetInstallerDirectory(new_version). | 1428 FilePath active_setup_exe(installer_state.GetInstallerDirectory(new_version) |
1414 Append(setup_path.BaseName())); | 1429 .Append(kActiveSetupExe)); |
1430 CommandLine cmd(active_setup_exe); | |
1415 cmd.AppendSwitch(installer::switches::kConfigureUserSettings); | 1431 cmd.AppendSwitch(installer::switches::kConfigureUserSettings); |
1416 cmd.AppendSwitch(installer::switches::kVerboseLogging); | 1432 cmd.AppendSwitch(installer::switches::kVerboseLogging); |
1417 cmd.AppendSwitch(installer::switches::kSystemLevel); | 1433 cmd.AppendSwitch(installer::switches::kSystemLevel); |
1418 product.AppendProductFlags(&cmd); | 1434 product.AppendProductFlags(&cmd); |
1419 list->AddSetRegValueWorkItem(root, active_setup_path, L"StubPath", | 1435 list->AddSetRegValueWorkItem(root, active_setup_path, L"StubPath", |
1420 cmd.GetCommandLineString(), true); | 1436 cmd.GetCommandLineString(), true); |
1421 | 1437 |
1422 // TODO(grt): http://crbug.com/75152 Write a reference to a localized | 1438 // TODO(grt): http://crbug.com/75152 Write a reference to a localized |
1423 // resource. | 1439 // resource. |
1424 list->AddSetRegValueWorkItem(root, active_setup_path, L"Localized Name", | 1440 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. | 1636 // Log everything for now. |
1621 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); | 1637 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); |
1622 | 1638 |
1623 AppCommand cmd(cmd_line.GetCommandLineString()); | 1639 AppCommand cmd(cmd_line.GetCommandLineString()); |
1624 cmd.set_is_auto_run_on_os_upgrade(true); | 1640 cmd.set_is_auto_run_on_os_upgrade(true); |
1625 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); | 1641 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); |
1626 } | 1642 } |
1627 } | 1643 } |
1628 | 1644 |
1629 } // namespace installer | 1645 } // namespace installer |
OLD | NEW |