| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } | 375 } |
| 376 } | 376 } |
| 377 } | 377 } |
| 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 bool do_not_create_any_shortcuts = false; |
| 386 prefs.GetBool(master_preferences::kDoNotCreateAnyShortcuts, |
| 387 &do_not_create_any_shortcuts); |
| 388 if (do_not_create_any_shortcuts) |
| 389 return; |
| 390 |
| 385 // Extract shortcut preferences from |prefs|. | 391 // Extract shortcut preferences from |prefs|. |
| 386 bool do_not_create_desktop_shortcut = false; | 392 bool do_not_create_desktop_shortcut = false; |
| 387 bool do_not_create_quick_launch_shortcut = false; | 393 bool do_not_create_quick_launch_shortcut = false; |
| 394 bool do_not_create_taskbar_shortcut = false; |
| 388 bool alternate_desktop_shortcut = false; | 395 bool alternate_desktop_shortcut = false; |
| 389 prefs.GetBool(master_preferences::kDoNotCreateDesktopShortcut, | 396 prefs.GetBool(master_preferences::kDoNotCreateDesktopShortcut, |
| 390 &do_not_create_desktop_shortcut); | 397 &do_not_create_desktop_shortcut); |
| 391 prefs.GetBool(master_preferences::kDoNotCreateQuickLaunchShortcut, | 398 prefs.GetBool(master_preferences::kDoNotCreateQuickLaunchShortcut, |
| 392 &do_not_create_quick_launch_shortcut); | 399 &do_not_create_quick_launch_shortcut); |
| 400 prefs.GetBool(master_preferences::kDoNotCreateTaskbarShortcut, |
| 401 &do_not_create_taskbar_shortcut); |
| 393 prefs.GetBool(master_preferences::kAltShortcutText, | 402 prefs.GetBool(master_preferences::kAltShortcutText, |
| 394 &alternate_desktop_shortcut); | 403 &alternate_desktop_shortcut); |
| 395 | 404 |
| 396 BrowserDistribution* dist = product.distribution(); | 405 BrowserDistribution* dist = product.distribution(); |
| 397 | 406 |
| 398 // The default operation on update is to overwrite shortcuts with the | 407 // The default operation on update is to overwrite shortcuts with the |
| 399 // currently desired properties, but do so only for shortcuts that still | 408 // currently desired properties, but do so only for shortcuts that still |
| 400 // exist. | 409 // exist. |
| 401 ShellUtil::ShortcutOperation shortcut_operation; | 410 ShellUtil::ShortcutOperation shortcut_operation; |
| 402 switch (install_operation) { | 411 switch (install_operation) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 ExecuteAndLogShortcutOperation( | 459 ExecuteAndLogShortcutOperation( |
| 451 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, | 460 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, |
| 452 quick_launch_properties, shortcut_operation); | 461 quick_launch_properties, shortcut_operation); |
| 453 } | 462 } |
| 454 | 463 |
| 455 ShellUtil::ShortcutProperties start_menu_properties(base_properties); | 464 ShellUtil::ShortcutProperties start_menu_properties(base_properties); |
| 456 // IMPORTANT: Only the default (no arguments and default browserappid) browser | 465 // IMPORTANT: Only the default (no arguments and default browserappid) browser |
| 457 // shortcut in the Start menu (Start screen on Win8+) should be made dual | 466 // shortcut in the Start menu (Start screen on Win8+) should be made dual |
| 458 // mode. | 467 // mode. |
| 459 start_menu_properties.set_dual_mode(true); | 468 start_menu_properties.set_dual_mode(true); |
| 460 if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || | 469 if (!do_not_create_taskbar_shortcut && |
| 461 shortcut_operation == | 470 (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || |
| 462 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) { | 471 shortcut_operation == |
| 472 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)) { |
| 463 start_menu_properties.set_pin_to_taskbar(true); | 473 start_menu_properties.set_pin_to_taskbar(true); |
| 464 } | 474 } |
| 465 ExecuteAndLogShortcutOperation(ShellUtil::SHORTCUT_LOCATION_START_MENU, | 475 ExecuteAndLogShortcutOperation(ShellUtil::SHORTCUT_LOCATION_START_MENU, |
| 466 dist, start_menu_properties, | 476 dist, start_menu_properties, |
| 467 shortcut_operation); | 477 shortcut_operation); |
| 468 } | 478 } |
| 469 | 479 |
| 470 void RegisterChromeOnMachine(const InstallerState& installer_state, | 480 void RegisterChromeOnMachine(const InstallerState& installer_state, |
| 471 const Product& product, | 481 const Product& product, |
| 472 bool make_chrome_default) { | 482 bool make_chrome_default) { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 if (app_host_path.empty()) | 714 if (app_host_path.empty()) |
| 705 return false; | 715 return false; |
| 706 | 716 |
| 707 CommandLine cmd(app_host_path); | 717 CommandLine cmd(app_host_path); |
| 708 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); | 718 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); |
| 709 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); | 719 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); |
| 710 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); | 720 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); |
| 711 } | 721 } |
| 712 | 722 |
| 713 } // namespace installer | 723 } // namespace installer |
| OLD | NEW |