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

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 RegisterEventLogProvider unit test. 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
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())
455 RegisterEventLogProvider(installer_state.target_path(), version);
456
451 // Make Chrome the default browser if desired when possible. Otherwise, only 457 // Make Chrome the default browser if desired when possible. Otherwise, only
452 // register it with Windows. 458 // register it with Windows.
453 BrowserDistribution* dist = product.distribution(); 459 BrowserDistribution* dist = product.distribution();
454 const base::FilePath chrome_exe( 460 const base::FilePath chrome_exe(
455 installer_state.target_path().Append(installer::kChromeExe)); 461 installer_state.target_path().Append(installer::kChromeExe));
456 VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value(); 462 VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value();
457 if (make_chrome_default && ShellUtil::CanMakeChromeDefaultUnattended()) { 463 if (make_chrome_default && ShellUtil::CanMakeChromeDefaultUnattended()) {
458 int level = ShellUtil::CURRENT_USER; 464 int level = ShellUtil::CURRENT_USER;
459 if (installer_state.system_install()) 465 if (installer_state.system_install())
460 level = level | ShellUtil::SYSTEM_LEVEL; 466 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 561 // 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 562 // force it here because the master_preferences file will not get copied
557 // into the build. 563 // into the build.
558 bool force_chrome_default_for_user = false; 564 bool force_chrome_default_for_user = false;
559 if (result == NEW_VERSION_UPDATED || result == INSTALL_REPAIRED || 565 if (result == NEW_VERSION_UPDATED || result == INSTALL_REPAIRED ||
560 result == OLD_VERSION_DOWNGRADE || result == IN_USE_DOWNGRADE) { 566 result == OLD_VERSION_DOWNGRADE || result == IN_USE_DOWNGRADE) {
561 prefs.GetBool(master_preferences::kMakeChromeDefaultForUser, 567 prefs.GetBool(master_preferences::kMakeChromeDefaultForUser,
562 &force_chrome_default_for_user); 568 &force_chrome_default_for_user);
563 } 569 }
564 570
565 RegisterChromeOnMachine(installer_state, *chrome_product, 571 RegisterChromeOnMachine(
566 make_chrome_default || force_chrome_default_for_user); 572 installer_state, *chrome_product,
573 make_chrome_default || force_chrome_default_for_user, new_version);
567 574
568 if (!installer_state.system_install()) { 575 if (!installer_state.system_install()) {
569 DCHECK_EQ(chrome_product->distribution(), 576 DCHECK_EQ(chrome_product->distribution(),
570 BrowserDistribution::GetDistribution()); 577 BrowserDistribution::GetDistribution());
571 UpdateDefaultBrowserBeaconForPath( 578 UpdateDefaultBrowserBeaconForPath(
572 installer_state.target_path().Append(installer::kChromeExe)); 579 installer_state.target_path().Append(installer::kChromeExe));
573 } 580 }
574 } 581 }
575 582
576 // Delete files that belong to old versions of Chrome. If that fails during 583 // 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 647 // Update shortcuts at this install level (per-user shortcuts on system-level
641 // installs will be updated through Active Setup). 648 // installs will be updated through Active Setup).
642 const InstallShortcutLevel level = 649 const InstallShortcutLevel level =
643 installer_state.system_install() ? ALL_USERS : CURRENT_USER; 650 installer_state.system_install() ? ALL_USERS : CURRENT_USER;
644 const base::FilePath chrome_exe( 651 const base::FilePath chrome_exe(
645 installer_state.target_path().Append(kChromeExe)); 652 installer_state.target_path().Append(kChromeExe));
646 CreateOrUpdateShortcuts(chrome_exe, chrome, prefs, level, 653 CreateOrUpdateShortcuts(chrome_exe, chrome, prefs, level,
647 INSTALL_SHORTCUT_REPLACE_EXISTING); 654 INSTALL_SHORTCUT_REPLACE_EXISTING);
648 655
649 // Adapt Chrome registrations to this new OS. 656 // Adapt Chrome registrations to this new OS.
650 RegisterChromeOnMachine(installer_state, chrome, false); 657 RegisterChromeOnMachine(installer_state, chrome, false, installed_version);
651 658
652 // Active Setup registrations are sometimes lost across OS update, make sure 659 // 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 660 // 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, 661 // 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 662 // so it is fine to restart the dynamic components of the Active Setup version
656 // (ref. UpdateActiveSetupVersionWorkItem) from scratch. 663 // (ref. UpdateActiveSetupVersionWorkItem) from scratch.
657 // TODO(gab): This should really perform all registry only update steps (i.e., 664 // TODO(gab): This should really perform all registry only update steps (i.e.,
658 // something between InstallOrUpdateProduct and AddActiveSetupWorkItems, but 665 // something between InstallOrUpdateProduct and AddActiveSetupWorkItems, but
659 // this takes care of what is most required for now). 666 // this takes care of what is most required for now).
660 std::unique_ptr<WorkItemList> work_item_list(WorkItem::CreateWorkItemList()); 667 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. 724 // Read master_preferences copied beside chrome.exe at install.
718 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); 725 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs));
719 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); 726 base::FilePath chrome_exe(installation_root.Append(kChromeExe));
720 CreateOrUpdateShortcuts( 727 CreateOrUpdateShortcuts(
721 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); 728 chrome_exe, chrome, prefs, CURRENT_USER, install_operation);
722 729
723 UpdateDefaultBrowserBeaconForPath(chrome_exe); 730 UpdateDefaultBrowserBeaconForPath(chrome_exe);
724 } 731 }
725 732
726 } // namespace installer 733 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698