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> |
11 #include <shlobj.h> | 11 #include <shlobj.h> |
12 #include <time.h> | 12 #include <time.h> |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/bind.h" | 16 #include "base/bind.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
19 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
20 #include "base/logging.h" | 20 #include "base/logging.h" |
21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
23 #include "base/strings/string_split.h" | |
23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
24 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
25 #include "base/version.h" | 26 #include "base/version.h" |
26 #include "base/win/registry.h" | 27 #include "base/win/registry.h" |
27 #include "base/win/scoped_comptr.h" | 28 #include "base/win/scoped_comptr.h" |
28 #include "base/win/windows_version.h" | 29 #include "base/win/windows_version.h" |
29 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
30 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/installer/setup/app_launcher_installer.h" | 32 #include "chrome/installer/setup/app_launcher_installer.h" |
32 #include "chrome/installer/setup/install.h" | 33 #include "chrome/installer/setup/install.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
50 #include "chrome/installer/util/util_constants.h" | 51 #include "chrome/installer/util/util_constants.h" |
51 #include "chrome/installer/util/work_item_list.h" | 52 #include "chrome/installer/util/work_item_list.h" |
52 | 53 |
53 using base::ASCIIToUTF16; | 54 using base::ASCIIToUTF16; |
54 using base::win::RegKey; | 55 using base::win::RegKey; |
55 | 56 |
56 namespace installer { | 57 namespace installer { |
57 | 58 |
58 namespace { | 59 namespace { |
59 | 60 |
60 // The version identifying the work done by setup.exe --configure-user-settings | |
61 // on user login by way of Active Setup. Increase this value if the work done | |
62 // in setup_main.cc's handling of kConfigureUserSettings changes and should be | |
63 // executed again for all users. | |
64 const wchar_t kActiveSetupVersion[] = L"43,0,0,0"; | |
65 | |
66 // Although the UUID of the ChromeFrame class is used for the "current" value, | 61 // Although the UUID of the ChromeFrame class is used for the "current" value, |
67 // this is done only as a convenience; there is no need for the GUID of the Low | 62 // this is done only as a convenience; there is no need for the GUID of the Low |
68 // Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to | 63 // Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to |
69 // use this completely unrelated GUID for the "old" policies. | 64 // use this completely unrelated GUID for the "old" policies. |
70 const wchar_t kIELowRightsPolicyOldGuid[] = | 65 const wchar_t kIELowRightsPolicyOldGuid[] = |
71 L"{6C288DD7-76FB-4721-B628-56FAC252E199}"; | 66 L"{6C288DD7-76FB-4721-B628-56FAC252E199}"; |
72 | 67 |
73 const wchar_t kElevationPolicyKeyPath[] = | 68 const wchar_t kElevationPolicyKeyPath[] = |
74 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\"; | 69 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\"; |
75 | 70 |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 scoped_ptr<WorkItemList> no_rollback_list( | 529 scoped_ptr<WorkItemList> no_rollback_list( |
535 WorkItem::CreateNoRollbackWorkItemList()); | 530 WorkItem::CreateNoRollbackWorkItemList()); |
536 AddUninstallDelegateExecuteWorkItems( | 531 AddUninstallDelegateExecuteWorkItems( |
537 HKEY_CURRENT_USER, google_chrome_delegate_execute_path, | 532 HKEY_CURRENT_USER, google_chrome_delegate_execute_path, |
538 no_rollback_list.get()); | 533 no_rollback_list.get()); |
539 list->AddWorkItem(no_rollback_list.release()); | 534 list->AddWorkItem(no_rollback_list.release()); |
540 VLOG(1) << "Added deletion items for bad Canary registrations."; | 535 VLOG(1) << "Added deletion items for bad Canary registrations."; |
541 } | 536 } |
542 } | 537 } |
543 | 538 |
539 // Returns the version to be used for Active Setup as MM/XX/YY/ZZ where MM is | |
grt (UTC plus 2)
2015/06/29 17:41:49
MM,XX,YY,ZZ?
gab
2015/06/30 18:40:39
Major,X,Y,Z -- I don't think Major,Minor,Build,Rev
grt (UTC plus 2)
2015/06/30 18:54:49
My suggestion was to use commas rather than slashe
gab
2015/07/02 03:12:33
Ah I see, hadn't noticed I'd used slashes (indeed
| |
540 // |kActiveSetupMajorVersion| and other components may be updated in various | |
541 // situations. At this point YY represents the number of on-os-upgrade that were | |
542 // handled by this installation and XX/ZZ are unused. | |
543 base::string16 GetActiveSetupVersionFromExisting( | |
544 const base::string16& existing_version) { | |
545 // The major version and first component of the version identifying the work | |
546 // done by setup.exe --configure-user- settings on user login by way of Active | |
grt (UTC plus 2)
2015/06/29 17:41:49
--configure-user-settings
gab
2015/06/30 18:40:38
Done.
| |
547 // Setup. Increase this value if the work done in setup_main.cc's handling of | |
548 // kConfigureUserSettings changes and should be executed again for all users. | |
549 const base::char16 kActiveSetupMajorVersion[] = L"43"; | |
550 | |
551 std::vector<base::string16> version_components = base::SplitString( | |
552 existing_version, L",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | |
553 | |
554 // If |existing_version| was empty or otherwise corrupted, turn it into a | |
555 // valid one. | |
556 if (version_components.size() != 4U) { | |
grt (UTC plus 2)
2015/06/29 17:41:49
if (version_components.size() != 4U)
version_c
gab
2015/06/30 18:40:38
Done.
| |
557 version_components.resize(4U); | |
558 version_components[1] = L"0"; | |
559 version_components[2] = L"0"; | |
560 version_components[3] = L"0"; | |
561 } | |
562 | |
563 // Unconditionally update the major version. | |
564 version_components[0] = kActiveSetupMajorVersion; | |
565 | |
566 return JoinString(version_components, L","); | |
grt (UTC plus 2)
2015/06/29 17:41:49
L','
gab
2015/06/30 18:40:38
Done.
| |
567 } | |
568 | |
544 } // namespace | 569 } // namespace |
545 | 570 |
546 // This method adds work items to create (or update) Chrome uninstall entry in | 571 // This method adds work items to create (or update) Chrome uninstall entry in |
547 // either the Control Panel->Add/Remove Programs list or in the Omaha client | 572 // either the Control Panel->Add/Remove Programs list or in the Omaha client |
548 // state key if running under an MSI installer. | 573 // state key if running under an MSI installer. |
549 void AddUninstallShortcutWorkItems(const InstallerState& installer_state, | 574 void AddUninstallShortcutWorkItems(const InstallerState& installer_state, |
550 const base::FilePath& setup_path, | 575 const base::FilePath& setup_path, |
551 const Version& new_version, | 576 const Version& new_version, |
552 const Product& product, | 577 const Product& product, |
553 WorkItemList* install_list) { | 578 WorkItemList* install_list) { |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1234 AddVersionKeyWorkItems(root, | 1259 AddVersionKeyWorkItems(root, |
1235 dist->GetVersionKey(), | 1260 dist->GetVersionKey(), |
1236 dist->GetDisplayName(), | 1261 dist->GetDisplayName(), |
1237 new_version, | 1262 new_version, |
1238 add_language_identifier, | 1263 add_language_identifier, |
1239 install_list); | 1264 install_list); |
1240 | 1265 |
1241 AddDelegateExecuteWorkItems(installer_state, target_path, new_version, | 1266 AddDelegateExecuteWorkItems(installer_state, target_path, new_version, |
1242 product, install_list); | 1267 product, install_list); |
1243 | 1268 |
1244 AddActiveSetupWorkItems(installer_state, setup_path, new_version, product, | 1269 AddActiveSetupWorkItems(installer_state, new_version, product, |
1245 install_list); | 1270 install_list); |
1246 } | 1271 } |
1247 | 1272 |
1248 // Ensure that the Clients key for the binaries is gone for single installs | 1273 // Ensure that the Clients key for the binaries is gone for single installs |
1249 // (but not for SxS Chrome). | 1274 // (but not for SxS Chrome). |
1250 if (!installer_state.is_multi_install() && | 1275 if (!installer_state.is_multi_install() && |
1251 !InstallUtil::IsChromeSxSProcess()) { | 1276 !InstallUtil::IsChromeSxSProcess()) { |
1252 BrowserDistribution* binaries_dist = | 1277 BrowserDistribution* binaries_dist = |
1253 BrowserDistribution::GetSpecificDistribution( | 1278 BrowserDistribution::GetSpecificDistribution( |
1254 BrowserDistribution::CHROME_BINARIES); | 1279 BrowserDistribution::CHROME_BINARIES); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1392 L"ServerExecutable", | 1417 L"ServerExecutable", |
1393 delegate_execute.value(), | 1418 delegate_execute.value(), |
1394 true); | 1419 true); |
1395 | 1420 |
1396 subkey.assign(delegate_execute_path).append(L"\\Programmable"); | 1421 subkey.assign(delegate_execute_path).append(L"\\Programmable"); |
1397 list->AddCreateRegKeyWorkItem(root, subkey, WorkItem::kWow64Default); | 1422 list->AddCreateRegKeyWorkItem(root, subkey, WorkItem::kWow64Default); |
1398 } | 1423 } |
1399 } | 1424 } |
1400 | 1425 |
1401 void AddActiveSetupWorkItems(const InstallerState& installer_state, | 1426 void AddActiveSetupWorkItems(const InstallerState& installer_state, |
1402 const base::FilePath& setup_path, | |
1403 const Version& new_version, | 1427 const Version& new_version, |
1404 const Product& product, | 1428 const Product& product, |
1405 WorkItemList* list) { | 1429 WorkItemList* list) { |
1406 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); | 1430 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); |
1407 BrowserDistribution* dist = product.distribution(); | 1431 BrowserDistribution* dist = product.distribution(); |
1408 | 1432 |
1409 if (!product.is_chrome() || !installer_state.system_install()) { | 1433 if (!product.is_chrome() || !installer_state.system_install()) { |
1410 const char* install_level = | 1434 const char* install_level = |
1411 installer_state.system_install() ? "system" : "user"; | 1435 installer_state.system_install() ? "system" : "user"; |
1412 VLOG(1) << "No Active Setup processing to do for " << install_level | 1436 VLOG(1) << "No Active Setup processing to do for " << install_level |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1455 active_setup_path, | 1479 active_setup_path, |
1456 WorkItem::kWow64Default, | 1480 WorkItem::kWow64Default, |
1457 L"IsInstalled", | 1481 L"IsInstalled", |
1458 static_cast<DWORD>(1U), | 1482 static_cast<DWORD>(1U), |
1459 true); | 1483 true); |
1460 | 1484 |
1461 list->AddSetRegValueWorkItem(root, | 1485 list->AddSetRegValueWorkItem(root, |
1462 active_setup_path, | 1486 active_setup_path, |
1463 WorkItem::kWow64Default, | 1487 WorkItem::kWow64Default, |
1464 L"Version", | 1488 L"Version", |
1465 kActiveSetupVersion, | 1489 base::Bind(&GetActiveSetupVersionFromExisting)); |
1466 true); | |
1467 } | 1490 } |
1468 | 1491 |
1469 void AddDeleteOldIELowRightsPolicyWorkItems( | 1492 void AddDeleteOldIELowRightsPolicyWorkItems( |
1470 const InstallerState& installer_state, | 1493 const InstallerState& installer_state, |
1471 WorkItemList* install_list) { | 1494 WorkItemList* install_list) { |
1472 DCHECK(install_list); | 1495 DCHECK(install_list); |
1473 | 1496 |
1474 base::string16 key_path; | 1497 base::string16 key_path; |
1475 GetOldIELowRightsElevationPolicyKeyPath(&key_path); | 1498 GetOldIELowRightsElevationPolicyKeyPath(&key_path); |
1476 install_list->AddDeleteRegKeyWorkItem( | 1499 install_list->AddDeleteRegKeyWorkItem( |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1561 // Unconditionally remove the legacy Quick Enable command from the binaries. | 1584 // Unconditionally remove the legacy Quick Enable command from the binaries. |
1562 // Do this even if multi-install Chrome isn't installed to ensure that it is | 1585 // Do this even if multi-install Chrome isn't installed to ensure that it is |
1563 // not left behind in any case. | 1586 // not left behind in any case. |
1564 work_item_list->AddDeleteRegKeyWorkItem( | 1587 work_item_list->AddDeleteRegKeyWorkItem( |
1565 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) | 1588 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) |
1566 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + | 1589 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + |
1567 " command"); | 1590 " command"); |
1568 } | 1591 } |
1569 | 1592 |
1570 } // namespace installer | 1593 } // namespace installer |
OLD | NEW |