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

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

Issue 2507753002: Install the chrome event log provider together with the browser. (Closed)
Patch Set: Address comments. 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
« no previous file with comments | « chrome/installer/mini_installer/chrome.release ('k') | chrome/installer/setup/setup_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
446 // Try to add Chrome to Media Player shim inclusion list. We don't do any 447 // 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 448 // error checking here because this operation will fail if user doesn't
448 // have admin rights and we want to ignore the error. 449 // have admin rights and we want to ignore the error.
449 AddChromeToMediaPlayerList(); 450 AddChromeToMediaPlayerList();
450 451
452 // Register the event log provider for system-level installs only, as it
453 // requires admin privileges.
454 if (installer_state.system_install()) {
grt (UTC plus 2) 2016/11/24 14:26:13 nit: you can get rid of these braces now. :-)
pastarmovj 2016/12/08 15:33:55 Done.
455 RegisterEventLogProvider(installer_state.target_path(), version);
456 }
457
451 // Make Chrome the default browser if desired when possible. Otherwise, only 458 // Make Chrome the default browser if desired when possible. Otherwise, only
452 // register it with Windows. 459 // register it with Windows.
453 BrowserDistribution* dist = product.distribution(); 460 BrowserDistribution* dist = product.distribution();
454 const base::FilePath chrome_exe( 461 const base::FilePath chrome_exe(
455 installer_state.target_path().Append(installer::kChromeExe)); 462 installer_state.target_path().Append(installer::kChromeExe));
456 VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value(); 463 VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value();
457 if (make_chrome_default && ShellUtil::CanMakeChromeDefaultUnattended()) { 464 if (make_chrome_default && ShellUtil::CanMakeChromeDefaultUnattended()) {
458 int level = ShellUtil::CURRENT_USER; 465 int level = ShellUtil::CURRENT_USER;
459 if (installer_state.system_install()) 466 if (installer_state.system_install())
460 level = level | ShellUtil::SYSTEM_LEVEL; 467 level = level | ShellUtil::SYSTEM_LEVEL;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 // Chrome to become their default browser on the download page, we must 562 // 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 563 // force it here because the master_preferences file will not get copied
557 // into the build. 564 // into the build.
558 bool force_chrome_default_for_user = false; 565 bool force_chrome_default_for_user = false;
559 if (result == NEW_VERSION_UPDATED || result == INSTALL_REPAIRED || 566 if (result == NEW_VERSION_UPDATED || result == INSTALL_REPAIRED ||
560 result == OLD_VERSION_DOWNGRADE || result == IN_USE_DOWNGRADE) { 567 result == OLD_VERSION_DOWNGRADE || result == IN_USE_DOWNGRADE) {
561 prefs.GetBool(master_preferences::kMakeChromeDefaultForUser, 568 prefs.GetBool(master_preferences::kMakeChromeDefaultForUser,
562 &force_chrome_default_for_user); 569 &force_chrome_default_for_user);
563 } 570 }
564 571
565 RegisterChromeOnMachine(installer_state, *chrome_product, 572 RegisterChromeOnMachine(
566 make_chrome_default || force_chrome_default_for_user); 573 installer_state, *chrome_product,
574 make_chrome_default || force_chrome_default_for_user, new_version);
567 575
568 if (!installer_state.system_install()) { 576 if (!installer_state.system_install()) {
569 DCHECK_EQ(chrome_product->distribution(), 577 DCHECK_EQ(chrome_product->distribution(),
570 BrowserDistribution::GetDistribution()); 578 BrowserDistribution::GetDistribution());
571 UpdateDefaultBrowserBeaconForPath( 579 UpdateDefaultBrowserBeaconForPath(
572 installer_state.target_path().Append(installer::kChromeExe)); 580 installer_state.target_path().Append(installer::kChromeExe));
573 } 581 }
574 } 582 }
575 583
576 // Delete files that belong to old versions of Chrome. If that fails during 584 // 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 648 // Update shortcuts at this install level (per-user shortcuts on system-level
641 // installs will be updated through Active Setup). 649 // installs will be updated through Active Setup).
642 const InstallShortcutLevel level = 650 const InstallShortcutLevel level =
643 installer_state.system_install() ? ALL_USERS : CURRENT_USER; 651 installer_state.system_install() ? ALL_USERS : CURRENT_USER;
644 const base::FilePath chrome_exe( 652 const base::FilePath chrome_exe(
645 installer_state.target_path().Append(kChromeExe)); 653 installer_state.target_path().Append(kChromeExe));
646 CreateOrUpdateShortcuts(chrome_exe, chrome, prefs, level, 654 CreateOrUpdateShortcuts(chrome_exe, chrome, prefs, level,
647 INSTALL_SHORTCUT_REPLACE_EXISTING); 655 INSTALL_SHORTCUT_REPLACE_EXISTING);
648 656
649 // Adapt Chrome registrations to this new OS. 657 // Adapt Chrome registrations to this new OS.
650 RegisterChromeOnMachine(installer_state, chrome, false); 658 RegisterChromeOnMachine(installer_state, chrome, false, installed_version);
651 659
652 // Active Setup registrations are sometimes lost across OS update, make sure 660 // 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 661 // 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, 662 // 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 663 // so it is fine to restart the dynamic components of the Active Setup version
656 // (ref. UpdateActiveSetupVersionWorkItem) from scratch. 664 // (ref. UpdateActiveSetupVersionWorkItem) from scratch.
657 // TODO(gab): This should really perform all registry only update steps (i.e., 665 // TODO(gab): This should really perform all registry only update steps (i.e.,
658 // something between InstallOrUpdateProduct and AddActiveSetupWorkItems, but 666 // something between InstallOrUpdateProduct and AddActiveSetupWorkItems, but
659 // this takes care of what is most required for now). 667 // this takes care of what is most required for now).
660 std::unique_ptr<WorkItemList> work_item_list(WorkItem::CreateWorkItemList()); 668 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. 725 // Read master_preferences copied beside chrome.exe at install.
718 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); 726 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs));
719 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); 727 base::FilePath chrome_exe(installation_root.Append(kChromeExe));
720 CreateOrUpdateShortcuts( 728 CreateOrUpdateShortcuts(
721 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); 729 chrome_exe, chrome, prefs, CURRENT_USER, install_operation);
722 730
723 UpdateDefaultBrowserBeaconForPath(chrome_exe); 731 UpdateDefaultBrowserBeaconForPath(chrome_exe);
724 } 732 }
725 733
726 } // namespace installer 734 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/mini_installer/chrome.release ('k') | chrome/installer/setup/setup_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698