| OLD | NEW |
| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 message.append("(maybe the shortcut doesn't exist?) "); | 63 message.append("(maybe the shortcut doesn't exist?) "); |
| 64 message.append((properties.level == ShellUtil::CURRENT_USER) ? "per-user " : | 64 message.append((properties.level == ShellUtil::CURRENT_USER) ? "per-user " : |
| 65 "all-users "); | 65 "all-users "); |
| 66 switch (location) { | 66 switch (location) { |
| 67 case ShellUtil::SHORTCUT_LOCATION_DESKTOP: | 67 case ShellUtil::SHORTCUT_LOCATION_DESKTOP: |
| 68 message.append("Desktop "); | 68 message.append("Desktop "); |
| 69 break; | 69 break; |
| 70 case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH: | 70 case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH: |
| 71 message.append("Quick Launch "); | 71 message.append("Quick Launch "); |
| 72 break; | 72 break; |
| 73 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR: | 73 case ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT: |
| 74 message.append("Start menu "); |
| 75 break; |
| 76 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED: |
| 74 message.append("Start menu/" + | 77 message.append("Start menu/" + |
| 75 base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( | 78 base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( |
| 76 BrowserDistribution::SUBFOLDER_CHROME)) + | 79 BrowserDistribution::SUBFOLDER_CHROME)) + |
| 77 " "); | 80 " "); |
| 78 break; | 81 break; |
| 79 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: | 82 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: |
| 80 message.append("Start menu/" + | 83 message.append("Start menu/" + |
| 81 base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( | 84 base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( |
| 82 BrowserDistribution::SUBFOLDER_APPS)) + | 85 BrowserDistribution::SUBFOLDER_APPS)) + |
| 83 " "); | 86 " "); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 // IMPORTANT: Only the default (no arguments and default browserappid) browser | 419 // IMPORTANT: Only the default (no arguments and default browserappid) browser |
| 417 // shortcut in the Start menu (Start screen on Win8+) should be made dual | 420 // shortcut in the Start menu (Start screen on Win8+) should be made dual |
| 418 // mode and that prior to Windows 10 only. | 421 // mode and that prior to Windows 10 only. |
| 419 if (InstallUtil::ShouldInstallMetroProperties()) | 422 if (InstallUtil::ShouldInstallMetroProperties()) |
| 420 start_menu_properties.set_dual_mode(true); | 423 start_menu_properties.set_dual_mode(true); |
| 421 if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || | 424 if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || |
| 422 shortcut_operation == | 425 shortcut_operation == |
| 423 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) { | 426 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) { |
| 424 start_menu_properties.set_pin_to_taskbar(!do_not_create_taskbar_shortcut); | 427 start_menu_properties.set_pin_to_taskbar(!do_not_create_taskbar_shortcut); |
| 425 } | 428 } |
| 429 |
| 430 // The attempt below to update the stortcut will fail if it does not already |
| 431 // exist at the expected location on disk. First check if it exists in the |
| 432 // previous location (under a subdirectory) and, if so, move it to the new |
| 433 // location. |
| 434 base::FilePath old_shortcut_path; |
| 435 ShellUtil::GetShortcutPath( |
| 436 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist, |
| 437 shortcut_level, &old_shortcut_path); |
| 438 if (base::PathExists(old_shortcut_path)) { |
| 439 ShellUtil::MoveExistingShortcut( |
| 440 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, |
| 441 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, |
| 442 dist, start_menu_properties); |
| 443 } |
| 444 |
| 426 ExecuteAndLogShortcutOperation( | 445 ExecuteAndLogShortcutOperation( |
| 427 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist, | 446 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist, |
| 428 start_menu_properties, shortcut_operation); | 447 start_menu_properties, shortcut_operation); |
| 429 } | 448 } |
| 430 | 449 |
| 431 void RegisterChromeOnMachine(const installer::InstallerState& installer_state, | 450 void RegisterChromeOnMachine(const installer::InstallerState& installer_state, |
| 432 const installer::Product& product, | 451 const installer::Product& product, |
| 433 bool make_chrome_default) { | 452 bool make_chrome_default) { |
| 434 DCHECK(product.is_chrome()); | 453 DCHECK(product.is_chrome()); |
| 435 | 454 |
| 436 // Try to add Chrome to Media Player shim inclusion list. We don't do any | 455 // Try to add Chrome to Media Player shim inclusion list. We don't do any |
| 437 // error checking here because this operation will fail if user doesn't | 456 // error checking here because this operation will fail if user doesn't |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 // Read master_preferences copied beside chrome.exe at install. | 691 // Read master_preferences copied beside chrome.exe at install. |
| 673 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 692 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
| 674 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 693 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
| 675 CreateOrUpdateShortcuts( | 694 CreateOrUpdateShortcuts( |
| 676 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 695 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
| 677 | 696 |
| 678 UpdateDefaultBrowserBeaconForPath(chrome_exe); | 697 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
| 679 } | 698 } |
| 680 | 699 |
| 681 } // namespace installer | 700 } // namespace installer |
| OLD | NEW |