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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 message.append("(maybe the shortcut doesn't exist?) "); | 69 message.append("(maybe the shortcut doesn't exist?) "); |
70 message.append((properties.level == ShellUtil::CURRENT_USER) ? "per-user " : | 70 message.append((properties.level == ShellUtil::CURRENT_USER) ? "per-user " : |
71 "all-users "); | 71 "all-users "); |
72 switch (location) { | 72 switch (location) { |
73 case ShellUtil::SHORTCUT_LOCATION_DESKTOP: | 73 case ShellUtil::SHORTCUT_LOCATION_DESKTOP: |
74 message.append("Desktop "); | 74 message.append("Desktop "); |
75 break; | 75 break; |
76 case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH: | 76 case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH: |
77 message.append("Quick Launch "); | 77 message.append("Quick Launch "); |
78 break; | 78 break; |
79 case ShellUtil::SHORTCUT_LOCATION_START_MENU: | 79 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR: |
80 message.append("Start menu "); | 80 message.append("Start menu/Google Chrome "); |
81 break; | 81 break; |
82 default: | 82 default: |
83 NOTREACHED(); | 83 NOTREACHED(); |
84 } | 84 } |
85 | 85 |
86 message.push_back('"'); | 86 message.push_back('"'); |
87 if (properties.has_shortcut_name()) | 87 if (properties.has_shortcut_name()) |
88 message.append(UTF16ToUTF8(properties.shortcut_name)); | 88 message.append(UTF16ToUTF8(properties.shortcut_name)); |
89 else | 89 else |
90 message.append(UTF16ToUTF8(dist->GetDisplayName())); | 90 message.append(UTF16ToUTF8(dist->GetDisplayName())); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // this is a system-level install, also deletes the old Default user Quick | 246 // this is a system-level install, also deletes the old Default user Quick |
247 // Launch shortcut. Both of these were created prior to Chrome 24; in Chrome 24, | 247 // Launch shortcut. Both of these were created prior to Chrome 24; in Chrome 24, |
248 // the uninstall shortcut was removed and the Default user Quick Launch shortcut | 248 // the uninstall shortcut was removed and the Default user Quick Launch shortcut |
249 // was replaced by per-user shortcuts created via Active Setup. | 249 // was replaced by per-user shortcuts created via Active Setup. |
250 void CleanupLegacyShortcuts(const InstallerState& installer_state, | 250 void CleanupLegacyShortcuts(const InstallerState& installer_state, |
251 BrowserDistribution* dist, | 251 BrowserDistribution* dist, |
252 const base::FilePath& chrome_exe) { | 252 const base::FilePath& chrome_exe) { |
253 ShellUtil::ShellChange shortcut_level = installer_state.system_install() ? | 253 ShellUtil::ShellChange shortcut_level = installer_state.system_install() ? |
254 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; | 254 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; |
255 base::FilePath uninstall_shortcut_path; | 255 base::FilePath uninstall_shortcut_path; |
256 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, | 256 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |
257 shortcut_level, &uninstall_shortcut_path); | 257 dist, shortcut_level, &uninstall_shortcut_path); |
258 uninstall_shortcut_path = uninstall_shortcut_path.Append( | 258 uninstall_shortcut_path = uninstall_shortcut_path.Append( |
259 dist->GetUninstallLinkName() + installer::kLnkExt); | 259 dist->GetUninstallLinkName() + installer::kLnkExt); |
260 base::DeleteFile(uninstall_shortcut_path, false); | 260 base::DeleteFile(uninstall_shortcut_path, false); |
261 | 261 |
262 if (installer_state.system_install()) { | 262 if (installer_state.system_install()) { |
263 ShellUtil::RemoveShortcuts( | 263 ShellUtil::RemoveShortcuts( |
264 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, | 264 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, |
265 ShellUtil::SYSTEM_LEVEL, chrome_exe); | 265 ShellUtil::SYSTEM_LEVEL, chrome_exe); |
266 } | 266 } |
267 } | 267 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 // IMPORTANT: Only the default (no arguments and default browserappid) browser | 448 // IMPORTANT: Only the default (no arguments and default browserappid) browser |
449 // shortcut in the Start menu (Start screen on Win8+) should be made dual | 449 // shortcut in the Start menu (Start screen on Win8+) should be made dual |
450 // mode. | 450 // mode. |
451 start_menu_properties.set_dual_mode(true); | 451 start_menu_properties.set_dual_mode(true); |
452 if (!do_not_create_taskbar_shortcut && | 452 if (!do_not_create_taskbar_shortcut && |
453 (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || | 453 (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || |
454 shortcut_operation == | 454 shortcut_operation == |
455 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)) { | 455 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)) { |
456 start_menu_properties.set_pin_to_taskbar(true); | 456 start_menu_properties.set_pin_to_taskbar(true); |
457 } | 457 } |
458 ExecuteAndLogShortcutOperation(ShellUtil::SHORTCUT_LOCATION_START_MENU, | 458 ExecuteAndLogShortcutOperation( |
459 dist, start_menu_properties, | 459 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist, |
460 shortcut_operation); | 460 start_menu_properties, shortcut_operation); |
461 } | 461 } |
462 | 462 |
463 void RegisterChromeOnMachine(const InstallerState& installer_state, | 463 void RegisterChromeOnMachine(const InstallerState& installer_state, |
464 const Product& product, | 464 const Product& product, |
465 bool make_chrome_default) { | 465 bool make_chrome_default) { |
466 DCHECK(product.is_chrome()); | 466 DCHECK(product.is_chrome()); |
467 | 467 |
468 // Try to add Chrome to Media Player shim inclusion list. We don't do any | 468 // Try to add Chrome to Media Player shim inclusion list. We don't do any |
469 // error checking here because this operation will fail if user doesn't | 469 // error checking here because this operation will fail if user doesn't |
470 // have admin rights and we want to ignore the error. | 470 // have admin rights and we want to ignore the error. |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 if (app_host_path.empty()) | 694 if (app_host_path.empty()) |
695 return false; | 695 return false; |
696 | 696 |
697 CommandLine cmd(app_host_path); | 697 CommandLine cmd(app_host_path); |
698 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); | 698 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); |
699 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); | 699 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); |
700 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); | 700 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); |
701 } | 701 } |
702 | 702 |
703 } // namespace installer | 703 } // namespace installer |
OLD | NEW |