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

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

Issue 1213913002: Update Chrome's Active Setup version per component instead of as a single string. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@active_setup_onosup_addCB_API
Patch Set: parametrized test Created 5 years, 5 months 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
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>
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
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
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
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
544 } // namespace 565 } // namespace
545 566
546 // This method adds work items to create (or update) Chrome uninstall entry in 567 // 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 568 // either the Control Panel->Add/Remove Programs list or in the Omaha client
548 // state key if running under an MSI installer. 569 // state key if running under an MSI installer.
549 void AddUninstallShortcutWorkItems(const InstallerState& installer_state, 570 void AddUninstallShortcutWorkItems(const InstallerState& installer_state,
550 const base::FilePath& setup_path, 571 const base::FilePath& setup_path,
551 const Version& new_version, 572 const Version& new_version,
552 const Product& product, 573 const Product& product,
553 WorkItemList* install_list) { 574 WorkItemList* install_list) {
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 AddVersionKeyWorkItems(root, 1255 AddVersionKeyWorkItems(root,
1235 dist->GetVersionKey(), 1256 dist->GetVersionKey(),
1236 dist->GetDisplayName(), 1257 dist->GetDisplayName(),
1237 new_version, 1258 new_version,
1238 add_language_identifier, 1259 add_language_identifier,
1239 install_list); 1260 install_list);
1240 1261
1241 AddDelegateExecuteWorkItems(installer_state, target_path, new_version, 1262 AddDelegateExecuteWorkItems(installer_state, target_path, new_version,
1242 product, install_list); 1263 product, install_list);
1243 1264
1244 AddActiveSetupWorkItems(installer_state, setup_path, new_version, product, 1265 AddActiveSetupWorkItems(installer_state, new_version, product,
1245 install_list); 1266 install_list);
1246 } 1267 }
1247 1268
1248 // Ensure that the Clients key for the binaries is gone for single installs 1269 // Ensure that the Clients key for the binaries is gone for single installs
1249 // (but not for SxS Chrome). 1270 // (but not for SxS Chrome).
1250 if (!installer_state.is_multi_install() && 1271 if (!installer_state.is_multi_install() &&
1251 !InstallUtil::IsChromeSxSProcess()) { 1272 !InstallUtil::IsChromeSxSProcess()) {
1252 BrowserDistribution* binaries_dist = 1273 BrowserDistribution* binaries_dist =
1253 BrowserDistribution::GetSpecificDistribution( 1274 BrowserDistribution::GetSpecificDistribution(
1254 BrowserDistribution::CHROME_BINARIES); 1275 BrowserDistribution::CHROME_BINARIES);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 L"ServerExecutable", 1413 L"ServerExecutable",
1393 delegate_execute.value(), 1414 delegate_execute.value(),
1394 true); 1415 true);
1395 1416
1396 subkey.assign(delegate_execute_path).append(L"\\Programmable"); 1417 subkey.assign(delegate_execute_path).append(L"\\Programmable");
1397 list->AddCreateRegKeyWorkItem(root, subkey, WorkItem::kWow64Default); 1418 list->AddCreateRegKeyWorkItem(root, subkey, WorkItem::kWow64Default);
1398 } 1419 }
1399 } 1420 }
1400 1421
1401 void AddActiveSetupWorkItems(const InstallerState& installer_state, 1422 void AddActiveSetupWorkItems(const InstallerState& installer_state,
1402 const base::FilePath& setup_path,
1403 const Version& new_version, 1423 const Version& new_version,
1404 const Product& product, 1424 const Product& product,
1405 WorkItemList* list) { 1425 WorkItemList* list) {
1406 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); 1426 DCHECK(installer_state.operation() != InstallerState::UNINSTALL);
1407 BrowserDistribution* dist = product.distribution(); 1427 BrowserDistribution* dist = product.distribution();
1408 1428
1409 if (!product.is_chrome() || !installer_state.system_install()) { 1429 if (!product.is_chrome() || !installer_state.system_install()) {
1410 const char* install_level = 1430 const char* install_level =
1411 installer_state.system_install() ? "system" : "user"; 1431 installer_state.system_install() ? "system" : "user";
1412 VLOG(1) << "No Active Setup processing to do for " << install_level 1432 VLOG(1) << "No Active Setup processing to do for " << install_level
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 active_setup_path, 1475 active_setup_path,
1456 WorkItem::kWow64Default, 1476 WorkItem::kWow64Default,
1457 L"IsInstalled", 1477 L"IsInstalled",
1458 static_cast<DWORD>(1U), 1478 static_cast<DWORD>(1U),
1459 true); 1479 true);
1460 1480
1461 list->AddSetRegValueWorkItem(root, 1481 list->AddSetRegValueWorkItem(root,
1462 active_setup_path, 1482 active_setup_path,
1463 WorkItem::kWow64Default, 1483 WorkItem::kWow64Default,
1464 L"Version", 1484 L"Version",
1465 kActiveSetupVersion, 1485 base::Bind(&GetActiveSetupVersionFromExisting));
1466 true);
1467 } 1486 }
1468 1487
1469 void AddDeleteOldIELowRightsPolicyWorkItems( 1488 void AddDeleteOldIELowRightsPolicyWorkItems(
1470 const InstallerState& installer_state, 1489 const InstallerState& installer_state,
1471 WorkItemList* install_list) { 1490 WorkItemList* install_list) {
1472 DCHECK(install_list); 1491 DCHECK(install_list);
1473 1492
1474 base::string16 key_path; 1493 base::string16 key_path;
1475 GetOldIELowRightsElevationPolicyKeyPath(&key_path); 1494 GetOldIELowRightsElevationPolicyKeyPath(&key_path);
1476 install_list->AddDeleteRegKeyWorkItem( 1495 install_list->AddDeleteRegKeyWorkItem(
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 // Unconditionally remove the legacy Quick Enable command from the binaries. 1580 // 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 1581 // Do this even if multi-install Chrome isn't installed to ensure that it is
1563 // not left behind in any case. 1582 // not left behind in any case.
1564 work_item_list->AddDeleteRegKeyWorkItem( 1583 work_item_list->AddDeleteRegKeyWorkItem(
1565 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY) 1584 installer_state.root_key(), cmd_key, KEY_WOW64_32KEY)
1566 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + 1585 ->set_log_message("removing " + base::UTF16ToASCII(kCmdQuickEnableCf) +
1567 " command"); 1586 " command");
1568 } 1587 }
1569 1588
1570 } // namespace installer 1589 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_worker.h ('k') | chrome/installer/setup/install_worker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698