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

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

Issue 2507753002: Install the chrome event log provider together with the browser. (Closed)
Patch Set: Fix formatting. Created 4 years 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 #include "chrome/installer/setup/install.h" 5 #include "chrome/installer/setup/install.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 #include <time.h> 9 #include <time.h>
10 10
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 dist, start_menu_properties); 433 dist, start_menu_properties);
434 } 434 }
435 435
436 ExecuteAndLogShortcutOperation( 436 ExecuteAndLogShortcutOperation(
437 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist, 437 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist,
438 start_menu_properties, shortcut_operation); 438 start_menu_properties, shortcut_operation);
439 } 439 }
440 440
441 void RegisterChromeOnMachine(const installer::InstallerState& installer_state, 441 void RegisterChromeOnMachine(const installer::InstallerState& installer_state,
442 const installer::Product& product, 442 const installer::Product& product,
443 bool make_chrome_default) { 443 bool make_chrome_default,
444 const base::Version& version) {
444 DCHECK(product.is_chrome()); 445 DCHECK(product.is_chrome());
445 446
447 const base::FilePath chrome_exe(
grt (UTC plus 2) 2016/11/24 07:49:34 nit: move this back down to line 465 where it was
pastarmovj 2016/11/24 09:51:09 Done.
448 installer_state.target_path().Append(installer::kChromeExe));
449
446 // Try to add Chrome to Media Player shim inclusion list. We don't do any 450 // Try to add Chrome to Media Player shim inclusion list. We don't do any
447 // error checking here because this operation will fail if user doesn't 451 // error checking here because this operation will fail if user doesn't
448 // have admin rights and we want to ignore the error. 452 // have admin rights and we want to ignore the error.
449 AddChromeToMediaPlayerList(); 453 AddChromeToMediaPlayerList();
450 454
455 // Register the event log provider for system-level installs only, as it
456 // requires admin privileges.
457 if (installer_state.system_install()) {
458 RegisterEventLogProvider(installer_state.target_path(),
459 version.GetString());
grt (UTC plus 2) 2016/11/24 07:49:34 nit: pass |version| by constref rather than string
pastarmovj 2016/11/24 09:51:09 Done.
460 }
461
451 // Make Chrome the default browser if desired when possible. Otherwise, only 462 // Make Chrome the default browser if desired when possible. Otherwise, only
452 // register it with Windows. 463 // register it with Windows.
453 BrowserDistribution* dist = product.distribution(); 464 BrowserDistribution* dist = product.distribution();
454 const base::FilePath chrome_exe(
455 installer_state.target_path().Append(installer::kChromeExe));
456 VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value(); 465 VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value();
457 if (make_chrome_default && ShellUtil::CanMakeChromeDefaultUnattended()) { 466 if (make_chrome_default && ShellUtil::CanMakeChromeDefaultUnattended()) {
458 int level = ShellUtil::CURRENT_USER; 467 int level = ShellUtil::CURRENT_USER;
459 if (installer_state.system_install()) 468 if (installer_state.system_install())
460 level = level | ShellUtil::SYSTEM_LEVEL; 469 level = level | ShellUtil::SYSTEM_LEVEL;
461 ShellUtil::MakeChromeDefault(dist, level, chrome_exe, true); 470 ShellUtil::MakeChromeDefault(dist, level, chrome_exe, true);
462 } else { 471 } else {
463 ShellUtil::RegisterChromeBrowser(dist, chrome_exe, base::string16(), false); 472 ShellUtil::RegisterChromeBrowser(dist, chrome_exe, base::string16(), false);
464 } 473 }
465 } 474 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 // Chrome to become their default browser on the download page, we must 564 // Chrome to become their default browser on the download page, we must
556 // force it here because the master_preferences file will not get copied 565 // force it here because the master_preferences file will not get copied
557 // into the build. 566 // into the build.
558 bool force_chrome_default_for_user = false; 567 bool force_chrome_default_for_user = false;
559 if (result == NEW_VERSION_UPDATED || result == INSTALL_REPAIRED || 568 if (result == NEW_VERSION_UPDATED || result == INSTALL_REPAIRED ||
560 result == OLD_VERSION_DOWNGRADE || result == IN_USE_DOWNGRADE) { 569 result == OLD_VERSION_DOWNGRADE || result == IN_USE_DOWNGRADE) {
561 prefs.GetBool(master_preferences::kMakeChromeDefaultForUser, 570 prefs.GetBool(master_preferences::kMakeChromeDefaultForUser,
562 &force_chrome_default_for_user); 571 &force_chrome_default_for_user);
563 } 572 }
564 573
565 RegisterChromeOnMachine(installer_state, *chrome_product, 574 RegisterChromeOnMachine(
566 make_chrome_default || force_chrome_default_for_user); 575 installer_state, *chrome_product,
576 make_chrome_default || force_chrome_default_for_user, new_version);
567 577
568 if (!installer_state.system_install()) { 578 if (!installer_state.system_install()) {
569 DCHECK_EQ(chrome_product->distribution(), 579 DCHECK_EQ(chrome_product->distribution(),
570 BrowserDistribution::GetDistribution()); 580 BrowserDistribution::GetDistribution());
571 UpdateDefaultBrowserBeaconForPath( 581 UpdateDefaultBrowserBeaconForPath(
572 installer_state.target_path().Append(installer::kChromeExe)); 582 installer_state.target_path().Append(installer::kChromeExe));
573 } 583 }
574 } 584 }
575 585
576 // Delete files that belong to old versions of Chrome. If that fails during 586 // Delete files that belong to old versions of Chrome. If that fails during
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 // Update shortcuts at this install level (per-user shortcuts on system-level 650 // Update shortcuts at this install level (per-user shortcuts on system-level
641 // installs will be updated through Active Setup). 651 // installs will be updated through Active Setup).
642 const InstallShortcutLevel level = 652 const InstallShortcutLevel level =
643 installer_state.system_install() ? ALL_USERS : CURRENT_USER; 653 installer_state.system_install() ? ALL_USERS : CURRENT_USER;
644 const base::FilePath chrome_exe( 654 const base::FilePath chrome_exe(
645 installer_state.target_path().Append(kChromeExe)); 655 installer_state.target_path().Append(kChromeExe));
646 CreateOrUpdateShortcuts(chrome_exe, chrome, prefs, level, 656 CreateOrUpdateShortcuts(chrome_exe, chrome, prefs, level,
647 INSTALL_SHORTCUT_REPLACE_EXISTING); 657 INSTALL_SHORTCUT_REPLACE_EXISTING);
648 658
649 // Adapt Chrome registrations to this new OS. 659 // Adapt Chrome registrations to this new OS.
650 RegisterChromeOnMachine(installer_state, chrome, false); 660 RegisterChromeOnMachine(installer_state, chrome, false, installed_version);
651 661
652 // Active Setup registrations are sometimes lost across OS update, make sure 662 // Active Setup registrations are sometimes lost across OS update, make sure
653 // they're back in place. Note: when Active Setup registrations in HKLM are 663 // they're back in place. Note: when Active Setup registrations in HKLM are
654 // lost, the per-user values of performed Active Setups in HKCU are also lost, 664 // lost, the per-user values of performed Active Setups in HKCU are also lost,
655 // so it is fine to restart the dynamic components of the Active Setup version 665 // so it is fine to restart the dynamic components of the Active Setup version
656 // (ref. UpdateActiveSetupVersionWorkItem) from scratch. 666 // (ref. UpdateActiveSetupVersionWorkItem) from scratch.
657 // TODO(gab): This should really perform all registry only update steps (i.e., 667 // TODO(gab): This should really perform all registry only update steps (i.e.,
658 // something between InstallOrUpdateProduct and AddActiveSetupWorkItems, but 668 // something between InstallOrUpdateProduct and AddActiveSetupWorkItems, but
659 // this takes care of what is most required for now). 669 // this takes care of what is most required for now).
660 std::unique_ptr<WorkItemList> work_item_list(WorkItem::CreateWorkItemList()); 670 std::unique_ptr<WorkItemList> work_item_list(WorkItem::CreateWorkItemList());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 // Read master_preferences copied beside chrome.exe at install. 727 // Read master_preferences copied beside chrome.exe at install.
718 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); 728 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs));
719 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); 729 base::FilePath chrome_exe(installation_root.Append(kChromeExe));
720 CreateOrUpdateShortcuts( 730 CreateOrUpdateShortcuts(
721 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); 731 chrome_exe, chrome, prefs, CURRENT_USER, install_operation);
722 732
723 UpdateDefaultBrowserBeaconForPath(chrome_exe); 733 UpdateDefaultBrowserBeaconForPath(chrome_exe);
724 } 734 }
725 735
726 } // namespace installer 736 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698