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

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

Issue 1780693002: Fix the path of Chrome shortcuts from the installer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self review Created 4 years, 9 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 #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
11 #include <string> 11 #include <string>
12 12
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/numerics/safe_conversions.h" 17 #include "base/numerics/safe_conversions.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/win/shortcut.h" 21 #include "base/win/shortcut.h"
22 #include "base/win/windows_version.h" 22 #include "base/win/windows_version.h"
23 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
24 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
25 #include "chrome/installer/setup/install_worker.h" 25 #include "chrome/installer/setup/install_worker.h"
26 #include "chrome/installer/setup/installer_crash_reporting.h" 26 #include "chrome/installer/setup/installer_crash_reporting.h"
27 #include "chrome/installer/setup/setup_constants.h" 27 #include "chrome/installer/setup/setup_constants.h"
28 #include "chrome/installer/setup/setup_util.h" 28 #include "chrome/installer/setup/setup_util.h"
29 #include "chrome/installer/setup/update_active_setup_version_work_item.h" 29 #include "chrome/installer/setup/update_active_setup_version_work_item.h"
30 #include "chrome/installer/setup/update_per_user_shortcuts_in_location.h"
30 #include "chrome/installer/util/beacons.h" 31 #include "chrome/installer/util/beacons.h"
31 #include "chrome/installer/util/browser_distribution.h" 32 #include "chrome/installer/util/browser_distribution.h"
32 #include "chrome/installer/util/create_reg_key_work_item.h" 33 #include "chrome/installer/util/create_reg_key_work_item.h"
33 #include "chrome/installer/util/delete_after_reboot_helper.h" 34 #include "chrome/installer/util/delete_after_reboot_helper.h"
34 #include "chrome/installer/util/google_update_constants.h" 35 #include "chrome/installer/util/google_update_constants.h"
35 #include "chrome/installer/util/helper.h" 36 #include "chrome/installer/util/helper.h"
36 #include "chrome/installer/util/install_util.h" 37 #include "chrome/installer/util/install_util.h"
37 #include "chrome/installer/util/master_preferences.h" 38 #include "chrome/installer/util/master_preferences.h"
38 #include "chrome/installer/util/master_preferences_constants.h" 39 #include "chrome/installer/util/master_preferences_constants.h"
39 #include "chrome/installer/util/set_reg_value_work_item.h" 40 #include "chrome/installer/util/set_reg_value_work_item.h"
41 #include "chrome/installer/util/shell_util.h"
40 #include "chrome/installer/util/util_constants.h" 42 #include "chrome/installer/util/util_constants.h"
41 #include "chrome/installer/util/work_item.h" 43 #include "chrome/installer/util/work_item.h"
42 #include "chrome/installer/util/work_item_list.h" 44 #include "chrome/installer/util/work_item_list.h"
43 45
44 46
45 namespace { 47 namespace {
46 48
47 void LogShortcutOperation(ShellUtil::ShortcutLocation location, 49 void LogShortcutOperation(ShellUtil::ShortcutLocation location,
48 BrowserDistribution* dist, 50 BrowserDistribution* dist,
49 const ShellUtil::ShortcutProperties& properties, 51 const ShellUtil::ShortcutProperties& properties,
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 if (base::PathExists(old_shortcut_path)) { 413 if (base::PathExists(old_shortcut_path)) {
412 ShellUtil::MoveExistingShortcut( 414 ShellUtil::MoveExistingShortcut(
413 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, 415 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED,
414 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, 416 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT,
415 dist, start_menu_properties); 417 dist, start_menu_properties);
416 } 418 }
417 419
418 ExecuteAndLogShortcutOperation( 420 ExecuteAndLogShortcutOperation(
419 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist, 421 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist,
420 start_menu_properties, shortcut_operation); 422 start_menu_properties, shortcut_operation);
423
424 // Update the target path of existing per-user shortcuts.
425 if (install_operation == INSTALL_SHORTCUT_REPLACE_EXISTING) {
426 const base::FilePath updated_prefix = target.DirName().DirName();
427 const base::FilePath updated_suffix = target.BaseName();
428
429 UpdatePerUserShortcutsInLocation(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist,
430 updated_prefix, updated_suffix, target);
431 UpdatePerUserShortcutsInLocation(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH,
432 dist, updated_prefix, updated_suffix,
433 target);
434 UpdatePerUserShortcutsInLocation(ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS,
435 dist, updated_prefix, updated_suffix,
436 target);
437 }
421 } 438 }
422 439
423 void RegisterChromeOnMachine(const installer::InstallerState& installer_state, 440 void RegisterChromeOnMachine(const installer::InstallerState& installer_state,
424 const installer::Product& product, 441 const installer::Product& product,
425 bool make_chrome_default) { 442 bool make_chrome_default) {
426 DCHECK(product.is_chrome()); 443 DCHECK(product.is_chrome());
427 444
428 // Try to add Chrome to Media Player shim inclusion list. We don't do any 445 // Try to add Chrome to Media Player shim inclusion list. We don't do any
429 // error checking here because this operation will fail if user doesn't 446 // error checking here because this operation will fail if user doesn't
430 // have admin rights and we want to ignore the error. 447 // have admin rights and we want to ignore the error.
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 // Read master_preferences copied beside chrome.exe at install. 670 // Read master_preferences copied beside chrome.exe at install.
654 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); 671 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs));
655 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); 672 base::FilePath chrome_exe(installation_root.Append(kChromeExe));
656 CreateOrUpdateShortcuts( 673 CreateOrUpdateShortcuts(
657 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); 674 chrome_exe, chrome, prefs, CURRENT_USER, install_operation);
658 675
659 UpdateDefaultBrowserBeaconForPath(chrome_exe); 676 UpdateDefaultBrowserBeaconForPath(chrome_exe);
660 } 677 }
661 678
662 } // namespace installer 679 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698