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