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 #include <winuser.h> | 10 #include <winuser.h> |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 378 |
379 void CreateOrUpdateShortcuts( | 379 void CreateOrUpdateShortcuts( |
380 const base::FilePath& target, | 380 const base::FilePath& target, |
381 const Product& product, | 381 const Product& product, |
382 const MasterPreferences& prefs, | 382 const MasterPreferences& prefs, |
383 InstallShortcutLevel install_level, | 383 InstallShortcutLevel install_level, |
384 InstallShortcutOperation install_operation) { | 384 InstallShortcutOperation install_operation) { |
385 // Extract shortcut preferences from |prefs|. | 385 // Extract shortcut preferences from |prefs|. |
386 bool do_not_create_desktop_shortcut = false; | 386 bool do_not_create_desktop_shortcut = false; |
387 bool do_not_create_quick_launch_shortcut = false; | 387 bool do_not_create_quick_launch_shortcut = false; |
| 388 bool do_not_create_start_menu_shortcut = false; |
388 bool alternate_desktop_shortcut = false; | 389 bool alternate_desktop_shortcut = false; |
389 prefs.GetBool(master_preferences::kDoNotCreateDesktopShortcut, | 390 prefs.GetBool(master_preferences::kDoNotCreateDesktopShortcut, |
390 &do_not_create_desktop_shortcut); | 391 &do_not_create_desktop_shortcut); |
391 prefs.GetBool(master_preferences::kDoNotCreateQuickLaunchShortcut, | 392 prefs.GetBool(master_preferences::kDoNotCreateQuickLaunchShortcut, |
392 &do_not_create_quick_launch_shortcut); | 393 &do_not_create_quick_launch_shortcut); |
| 394 prefs.GetBool(master_preferences::kDoNotCreateStartMenuShortcut, |
| 395 &do_not_create_start_menu_shortcut); |
393 prefs.GetBool(master_preferences::kAltShortcutText, | 396 prefs.GetBool(master_preferences::kAltShortcutText, |
394 &alternate_desktop_shortcut); | 397 &alternate_desktop_shortcut); |
395 | 398 |
396 BrowserDistribution* dist = product.distribution(); | 399 BrowserDistribution* dist = product.distribution(); |
397 | 400 |
398 // The default operation on update is to overwrite shortcuts with the | 401 // The default operation on update is to overwrite shortcuts with the |
399 // currently desired properties, but do so only for shortcuts that still | 402 // currently desired properties, but do so only for shortcuts that still |
400 // exist. | 403 // exist. |
401 ShellUtil::ShortcutOperation shortcut_operation; | 404 ShellUtil::ShortcutOperation shortcut_operation; |
402 switch (install_operation) { | 405 switch (install_operation) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) { | 448 shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) { |
446 // There is no such thing as an all-users Quick Launch shortcut, always | 449 // There is no such thing as an all-users Quick Launch shortcut, always |
447 // install the per-user shortcut. | 450 // install the per-user shortcut. |
448 ShellUtil::ShortcutProperties quick_launch_properties(base_properties); | 451 ShellUtil::ShortcutProperties quick_launch_properties(base_properties); |
449 quick_launch_properties.level = ShellUtil::CURRENT_USER; | 452 quick_launch_properties.level = ShellUtil::CURRENT_USER; |
450 ExecuteAndLogShortcutOperation( | 453 ExecuteAndLogShortcutOperation( |
451 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, | 454 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, |
452 quick_launch_properties, shortcut_operation); | 455 quick_launch_properties, shortcut_operation); |
453 } | 456 } |
454 | 457 |
455 ShellUtil::ShortcutProperties start_menu_properties(base_properties); | 458 if (!do_not_create_start_menu_shortcut || |
456 // IMPORTANT: Only the default (no arguments and default browserappid) browser | 459 shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) { |
457 // shortcut in the Start menu (Start screen on Win8+) should be made dual | 460 ShellUtil::ShortcutProperties start_menu_properties(base_properties); |
458 // mode. | 461 // IMPORTANT: Only the default (no arguments and default browserappid) |
459 start_menu_properties.set_dual_mode(true); | 462 // browser shortcut in the Start menu (Start screen on Win8+) should be made |
460 if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || | 463 // dual mode. |
461 shortcut_operation == | 464 start_menu_properties.set_dual_mode(true); |
462 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) { | 465 if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || |
463 start_menu_properties.set_pin_to_taskbar(true); | 466 shortcut_operation == |
| 467 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) { |
| 468 start_menu_properties.set_pin_to_taskbar(true); |
| 469 } |
| 470 ExecuteAndLogShortcutOperation(ShellUtil::SHORTCUT_LOCATION_START_MENU, |
| 471 dist, start_menu_properties, |
| 472 shortcut_operation); |
464 } | 473 } |
465 ExecuteAndLogShortcutOperation(ShellUtil::SHORTCUT_LOCATION_START_MENU, | |
466 dist, start_menu_properties, | |
467 shortcut_operation); | |
468 } | 474 } |
469 | 475 |
470 void RegisterChromeOnMachine(const InstallerState& installer_state, | 476 void RegisterChromeOnMachine(const InstallerState& installer_state, |
471 const Product& product, | 477 const Product& product, |
472 bool make_chrome_default) { | 478 bool make_chrome_default) { |
473 DCHECK(product.is_chrome()); | 479 DCHECK(product.is_chrome()); |
474 | 480 |
475 // Try to add Chrome to Media Player shim inclusion list. We don't do any | 481 // Try to add Chrome to Media Player shim inclusion list. We don't do any |
476 // error checking here because this operation will fail if user doesn't | 482 // error checking here because this operation will fail if user doesn't |
477 // have admin rights and we want to ignore the error. | 483 // have admin rights and we want to ignore the error. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 if (app_host_path.empty()) | 710 if (app_host_path.empty()) |
705 return false; | 711 return false; |
706 | 712 |
707 CommandLine cmd(app_host_path); | 713 CommandLine cmd(app_host_path); |
708 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); | 714 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); |
709 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); | 715 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); |
710 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); | 716 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); |
711 } | 717 } |
712 | 718 |
713 } // namespace installer | 719 } // namespace installer |
OLD | NEW |