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