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/" + |
82 UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( | |
83 BrowserDistribution::SUBFOLDER_CHROME)) + | |
gab
2013/11/25 13:05:10
nit: indent 4 more spaces here.
calamity
2013/11/26 02:51:17
Done.
| |
84 " "); | |
85 break; | |
86 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: | |
87 message.append("Start menu/" + | |
88 UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( | |
89 BrowserDistribution::SUBFOLDER_APPS)) + | |
gab
2013/11/25 13:05:10
and here.
calamity
2013/11/26 02:51:17
Done.
| |
90 " "); | |
82 break; | 91 break; |
83 default: | 92 default: |
84 NOTREACHED(); | 93 NOTREACHED(); |
85 } | 94 } |
86 | 95 |
87 message.push_back('"'); | 96 message.push_back('"'); |
88 if (properties.has_shortcut_name()) | 97 if (properties.has_shortcut_name()) |
89 message.append(UTF16ToUTF8(properties.shortcut_name)); | 98 message.append(UTF16ToUTF8(properties.shortcut_name)); |
90 else | 99 else |
91 message.append(UTF16ToUTF8(dist->GetDisplayName())); | 100 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 | 256 // 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, | 257 // 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 | 258 // the uninstall shortcut was removed and the Default user Quick Launch shortcut |
250 // was replaced by per-user shortcuts created via Active Setup. | 259 // was replaced by per-user shortcuts created via Active Setup. |
251 void CleanupLegacyShortcuts(const InstallerState& installer_state, | 260 void CleanupLegacyShortcuts(const InstallerState& installer_state, |
252 BrowserDistribution* dist, | 261 BrowserDistribution* dist, |
253 const base::FilePath& chrome_exe) { | 262 const base::FilePath& chrome_exe) { |
254 ShellUtil::ShellChange shortcut_level = installer_state.system_install() ? | 263 ShellUtil::ShellChange shortcut_level = installer_state.system_install() ? |
255 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; | 264 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; |
256 base::FilePath uninstall_shortcut_path; | 265 base::FilePath uninstall_shortcut_path; |
257 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, | 266 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |
258 shortcut_level, &uninstall_shortcut_path); | 267 dist, shortcut_level, &uninstall_shortcut_path); |
259 uninstall_shortcut_path = uninstall_shortcut_path.Append( | 268 uninstall_shortcut_path = uninstall_shortcut_path.Append( |
260 dist->GetUninstallLinkName() + installer::kLnkExt); | 269 dist->GetUninstallLinkName() + installer::kLnkExt); |
261 base::DeleteFile(uninstall_shortcut_path, false); | 270 base::DeleteFile(uninstall_shortcut_path, false); |
262 | 271 |
263 if (installer_state.system_install()) { | 272 if (installer_state.system_install()) { |
264 ShellUtil::RemoveShortcuts( | 273 ShellUtil::RemoveShortcuts( |
265 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, | 274 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, |
266 ShellUtil::SYSTEM_LEVEL, chrome_exe); | 275 ShellUtil::SYSTEM_LEVEL, chrome_exe); |
267 } | 276 } |
268 } | 277 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 // IMPORTANT: Only the default (no arguments and default browserappid) browser | 459 // IMPORTANT: Only the default (no arguments and default browserappid) browser |
451 // shortcut in the Start menu (Start screen on Win8+) should be made dual | 460 // shortcut in the Start menu (Start screen on Win8+) should be made dual |
452 // mode. | 461 // mode. |
453 start_menu_properties.set_dual_mode(true); | 462 start_menu_properties.set_dual_mode(true); |
454 if (!do_not_create_taskbar_shortcut && | 463 if (!do_not_create_taskbar_shortcut && |
455 (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || | 464 (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || |
456 shortcut_operation == | 465 shortcut_operation == |
457 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)) { | 466 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)) { |
458 start_menu_properties.set_pin_to_taskbar(true); | 467 start_menu_properties.set_pin_to_taskbar(true); |
459 } | 468 } |
460 ExecuteAndLogShortcutOperation(ShellUtil::SHORTCUT_LOCATION_START_MENU, | 469 ExecuteAndLogShortcutOperation( |
461 dist, start_menu_properties, | 470 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist, |
462 shortcut_operation); | 471 start_menu_properties, shortcut_operation); |
463 } | 472 } |
464 | 473 |
465 void RegisterChromeOnMachine(const InstallerState& installer_state, | 474 void RegisterChromeOnMachine(const InstallerState& installer_state, |
466 const Product& product, | 475 const Product& product, |
467 bool make_chrome_default) { | 476 bool make_chrome_default) { |
468 DCHECK(product.is_chrome()); | 477 DCHECK(product.is_chrome()); |
469 | 478 |
470 // Try to add Chrome to Media Player shim inclusion list. We don't do any | 479 // 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 | 480 // error checking here because this operation will fail if user doesn't |
472 // have admin rights and we want to ignore the error. | 481 // 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()) | 703 if (app_host_path.empty()) |
695 return false; | 704 return false; |
696 | 705 |
697 CommandLine cmd(app_host_path); | 706 CommandLine cmd(app_host_path); |
698 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); | 707 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); |
699 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); | 708 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); |
700 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); | 709 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); |
701 } | 710 } |
702 | 711 |
703 } // namespace installer | 712 } // namespace installer |
OLD | NEW |