| 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" | |
| 24 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 25 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 26 #include "base/version.h" | 25 #include "base/version.h" |
| 27 #include "base/win/registry.h" | 26 #include "base/win/registry.h" |
| 28 #include "base/win/scoped_comptr.h" | 27 #include "base/win/scoped_comptr.h" |
| 29 #include "base/win/windows_version.h" | 28 #include "base/win/windows_version.h" |
| 30 #include "chrome/common/chrome_constants.h" | 29 #include "chrome/common/chrome_constants.h" |
| 31 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/installer/setup/app_launcher_installer.h" | 31 #include "chrome/installer/setup/app_launcher_installer.h" |
| 33 #include "chrome/installer/setup/install.h" | 32 #include "chrome/installer/setup/install.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 scoped_ptr<WorkItemList> no_rollback_list( | 528 scoped_ptr<WorkItemList> no_rollback_list( |
| 530 WorkItem::CreateNoRollbackWorkItemList()); | 529 WorkItem::CreateNoRollbackWorkItemList()); |
| 531 AddUninstallDelegateExecuteWorkItems( | 530 AddUninstallDelegateExecuteWorkItems( |
| 532 HKEY_CURRENT_USER, google_chrome_delegate_execute_path, | 531 HKEY_CURRENT_USER, google_chrome_delegate_execute_path, |
| 533 no_rollback_list.get()); | 532 no_rollback_list.get()); |
| 534 list->AddWorkItem(no_rollback_list.release()); | 533 list->AddWorkItem(no_rollback_list.release()); |
| 535 VLOG(1) << "Added deletion items for bad Canary registrations."; | 534 VLOG(1) << "Added deletion items for bad Canary registrations."; |
| 536 } | 535 } |
| 537 } | 536 } |
| 538 | 537 |
| 539 // Returns the version to be used for Active Setup as MM/XX/YY/ZZ where MM is | |
| 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 | |
| 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) | |
| 557 version_components.assign(4U, L"0"); | |
| 558 | |
| 559 // Unconditionally update the major version. | |
| 560 version_components[0] = kActiveSetupMajorVersion; | |
| 561 | |
| 562 return JoinString(version_components, L','); | |
| 563 } | |
| 564 | |
| 565 } // namespace | 538 } // namespace |
| 566 | 539 |
| 567 // This method adds work items to create (or update) Chrome uninstall entry in | 540 // This method adds work items to create (or update) Chrome uninstall entry in |
| 568 // either the Control Panel->Add/Remove Programs list or in the Omaha client | 541 // either the Control Panel->Add/Remove Programs list or in the Omaha client |
| 569 // state key if running under an MSI installer. | 542 // state key if running under an MSI installer. |
| 570 void AddUninstallShortcutWorkItems(const InstallerState& installer_state, | 543 void AddUninstallShortcutWorkItems(const InstallerState& installer_state, |
| 571 const base::FilePath& setup_path, | 544 const base::FilePath& setup_path, |
| 572 const Version& new_version, | 545 const Version& new_version, |
| 573 const Product& product, | 546 const Product& product, |
| 574 WorkItemList* install_list) { | 547 WorkItemList* install_list) { |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 dist->GetDisplayName(), | 1444 dist->GetDisplayName(), |
| 1472 true); | 1445 true); |
| 1473 | 1446 |
| 1474 list->AddSetRegValueWorkItem(root, | 1447 list->AddSetRegValueWorkItem(root, |
| 1475 active_setup_path, | 1448 active_setup_path, |
| 1476 WorkItem::kWow64Default, | 1449 WorkItem::kWow64Default, |
| 1477 L"IsInstalled", | 1450 L"IsInstalled", |
| 1478 static_cast<DWORD>(1U), | 1451 static_cast<DWORD>(1U), |
| 1479 true); | 1452 true); |
| 1480 | 1453 |
| 1481 list->AddSetRegValueWorkItem(root, | 1454 // The major version and first component of the version identifying the work |
| 1482 active_setup_path, | 1455 // done by setup.exe --configure-user-settings on user login by way of Active |
| 1483 WorkItem::kWow64Default, | 1456 // Setup. Increase this value if the work done in setup_main.cc's handling of |
| 1484 L"Version", | 1457 // kConfigureUserSettings changes and should be executed again for all users. |
| 1485 base::Bind(&GetActiveSetupVersionFromExisting)); | 1458 const int kActiveSetupMajorVersion = 43; |
| 1459 |
| 1460 list->AddSetRegValueWorkItem( |
| 1461 root, active_setup_path, WorkItem::kWow64Default, L"Version", |
| 1462 base::Bind(&InstallUtil::GetActiveSetupVersionFromExisting, |
| 1463 InstallUtil::MAJOR, InstallUtil::SET, |
| 1464 kActiveSetupMajorVersion)); |
| 1486 } | 1465 } |
| 1487 | 1466 |
| 1488 void AddDeleteOldIELowRightsPolicyWorkItems( | 1467 void AddDeleteOldIELowRightsPolicyWorkItems( |
| 1489 const InstallerState& installer_state, | 1468 const InstallerState& installer_state, |
| 1490 WorkItemList* install_list) { | 1469 WorkItemList* install_list) { |
| 1491 DCHECK(install_list); | 1470 DCHECK(install_list); |
| 1492 | 1471 |
| 1493 base::string16 key_path; | 1472 base::string16 key_path; |
| 1494 GetOldIELowRightsElevationPolicyKeyPath(&key_path); | 1473 GetOldIELowRightsElevationPolicyKeyPath(&key_path); |
| 1495 install_list->AddDeleteRegKeyWorkItem( | 1474 install_list->AddDeleteRegKeyWorkItem( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 // Unconditionally remove the legacy Quick Enable command from the binaries. | 1559 // Unconditionally remove the legacy Quick Enable command from the binaries. |
| 1581 // Do this even if multi-install Chrome isn't installed to ensure that it is | 1560 // Do this even if multi-install Chrome isn't installed to ensure that it is |
| 1582 // not left behind in any case. | 1561 // not left behind in any case. |
| 1583 work_item_list->AddDeleteRegKeyWorkItem( | 1562 work_item_list->AddDeleteRegKeyWorkItem( |
| 1584 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) | 1563 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) |
| 1585 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + | 1564 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + |
| 1586 " command"); | 1565 " command"); |
| 1587 } | 1566 } |
| 1588 | 1567 |
| 1589 } // namespace installer | 1568 } // namespace installer |
| OLD | NEW |