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_ROOT: | 73 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR: |
74 message.append("Start menu "); | |
75 break; | |
76 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED: | |
77 message.append("Start menu/" + | 74 message.append("Start menu/" + |
78 base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( | 75 base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( |
79 BrowserDistribution::SUBFOLDER_CHROME)) + | 76 BrowserDistribution::SUBFOLDER_CHROME)) + |
80 " "); | 77 " "); |
81 break; | 78 break; |
82 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: | 79 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: |
83 message.append("Start menu/" + | 80 message.append("Start menu/" + |
84 base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( | 81 base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( |
85 BrowserDistribution::SUBFOLDER_APPS)) + | 82 BrowserDistribution::SUBFOLDER_APPS)) + |
86 " "); | 83 " "); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // IMPORTANT: Only the default (no arguments and default browserappid) browser | 416 // IMPORTANT: Only the default (no arguments and default browserappid) browser |
420 // 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 |
421 // mode and that prior to Windows 10 only. | 418 // mode and that prior to Windows 10 only. |
422 if (InstallUtil::ShouldInstallMetroProperties()) | 419 if (InstallUtil::ShouldInstallMetroProperties()) |
423 start_menu_properties.set_dual_mode(true); | 420 start_menu_properties.set_dual_mode(true); |
424 if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || | 421 if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || |
425 shortcut_operation == | 422 shortcut_operation == |
426 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) { | 423 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) { |
427 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); |
428 } | 425 } |
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 | |
445 ExecuteAndLogShortcutOperation( | 426 ExecuteAndLogShortcutOperation( |
446 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist, | 427 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist, |
447 start_menu_properties, shortcut_operation); | 428 start_menu_properties, shortcut_operation); |
448 } | 429 } |
449 | 430 |
450 void RegisterChromeOnMachine(const installer::InstallerState& installer_state, | 431 void RegisterChromeOnMachine(const installer::InstallerState& installer_state, |
451 const installer::Product& product, | 432 const installer::Product& product, |
452 bool make_chrome_default) { | 433 bool make_chrome_default) { |
453 DCHECK(product.is_chrome()); | 434 DCHECK(product.is_chrome()); |
454 | 435 |
455 // Try to add Chrome to Media Player shim inclusion list. We don't do any | 436 // Try to add Chrome to Media Player shim inclusion list. We don't do any |
456 // error checking here because this operation will fail if user doesn't | 437 // 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... |
691 // Read master_preferences copied beside chrome.exe at install. | 672 // Read master_preferences copied beside chrome.exe at install. |
692 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 673 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
693 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 674 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
694 CreateOrUpdateShortcuts( | 675 CreateOrUpdateShortcuts( |
695 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 676 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
696 | 677 |
697 UpdateDefaultBrowserBeaconForPath(chrome_exe); | 678 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
698 } | 679 } |
699 | 680 |
700 } // namespace installer | 681 } // namespace installer |
OLD | NEW |