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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 | 356 |
357 void CreateOrUpdateShortcuts( | 357 void CreateOrUpdateShortcuts( |
358 const base::FilePath& target, | 358 const base::FilePath& target, |
359 const Product& product, | 359 const Product& product, |
360 const MasterPreferences& prefs, | 360 const MasterPreferences& prefs, |
361 InstallShortcutLevel install_level, | 361 InstallShortcutLevel install_level, |
362 InstallShortcutOperation install_operation) { | 362 InstallShortcutOperation install_operation) { |
363 // Extract shortcut preferences from |prefs|. | 363 // Extract shortcut preferences from |prefs|. |
364 bool do_not_create_desktop_shortcut = false; | 364 bool do_not_create_desktop_shortcut = false; |
365 bool do_not_create_quick_launch_shortcut = false; | 365 bool do_not_create_quick_launch_shortcut = false; |
366 bool do_not_create_taskbar_shortcut = false; | |
367 bool do_not_create_any_shortcuts = false; | |
366 bool alternate_desktop_shortcut = false; | 368 bool alternate_desktop_shortcut = false; |
367 prefs.GetBool(master_preferences::kDoNotCreateDesktopShortcut, | 369 prefs.GetBool(master_preferences::kDoNotCreateDesktopShortcut, |
368 &do_not_create_desktop_shortcut); | 370 &do_not_create_desktop_shortcut); |
369 prefs.GetBool(master_preferences::kDoNotCreateQuickLaunchShortcut, | 371 prefs.GetBool(master_preferences::kDoNotCreateQuickLaunchShortcut, |
370 &do_not_create_quick_launch_shortcut); | 372 &do_not_create_quick_launch_shortcut); |
373 prefs.GetBool(master_preferences::kDoNotCreateTaskbarShortcut, | |
374 &do_not_create_taskbar_shortcut); | |
375 prefs.GetBool(master_preferences::kDoNotCreateAnyShortcuts, | |
376 &do_not_create_any_shortcuts); | |
371 prefs.GetBool(master_preferences::kAltShortcutText, | 377 prefs.GetBool(master_preferences::kAltShortcutText, |
372 &alternate_desktop_shortcut); | 378 &alternate_desktop_shortcut); |
373 | 379 |
374 BrowserDistribution* dist = product.distribution(); | 380 BrowserDistribution* dist = product.distribution(); |
375 | 381 |
376 // The default operation on update is to overwrite shortcuts with the | 382 // The default operation on update is to overwrite shortcuts with the |
377 // currently desired properties, but do so only for shortcuts that still | 383 // currently desired properties, but do so only for shortcuts that still |
378 // exist. | 384 // exist. |
379 ShellUtil::ShortcutOperation shortcut_operation; | 385 ShellUtil::ShortcutOperation shortcut_operation; |
380 switch (install_operation) { | 386 switch (install_operation) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) { | 429 shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) { |
424 // There is no such thing as an all-users Quick Launch shortcut, always | 430 // There is no such thing as an all-users Quick Launch shortcut, always |
425 // install the per-user shortcut. | 431 // install the per-user shortcut. |
426 ShellUtil::ShortcutProperties quick_launch_properties(base_properties); | 432 ShellUtil::ShortcutProperties quick_launch_properties(base_properties); |
427 quick_launch_properties.level = ShellUtil::CURRENT_USER; | 433 quick_launch_properties.level = ShellUtil::CURRENT_USER; |
428 ExecuteAndLogShortcutOperation( | 434 ExecuteAndLogShortcutOperation( |
429 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, | 435 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, |
430 quick_launch_properties, shortcut_operation); | 436 quick_launch_properties, shortcut_operation); |
431 } | 437 } |
432 | 438 |
433 ShellUtil::ShortcutProperties start_menu_properties(base_properties); | 439 // Currently, |do_not_create_any_shortcuts| only affects the creation of the |
gab
2013/03/06 20:20:32
I was seeing more "do_not_create_any_shortcuts" as
Joao da Silva
2013/03/06 21:21:33
Makes sense, done.
| |
434 // IMPORTANT: Only the default (no arguments and default browserappid) browser | 440 // start menu shortcut; all the other do_not_* flags are overridden by |
435 // shortcut in the Start menu (Start screen on Win8+) should be made dual | 441 // |do_not_create_any_shortcuts|. |
436 // mode. | 442 if (!do_not_create_any_shortcuts) { |
437 start_menu_properties.set_dual_mode(true); | 443 ShellUtil::ShortcutProperties start_menu_properties(base_properties); |
438 if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || | 444 // IMPORTANT: Only the default (no arguments and default browserappid) |
439 shortcut_operation == | 445 // browser shortcut in the Start menu (Start screen on Win8+) should be made |
440 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) { | 446 // dual mode. |
441 start_menu_properties.set_pin_to_taskbar(true); | 447 start_menu_properties.set_dual_mode(true); |
448 if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || | |
449 shortcut_operation == | |
450 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) { | |
451 start_menu_properties.set_pin_to_taskbar(!do_not_create_taskbar_shortcut); | |
gab
2013/03/06 20:20:32
Shouldn't set this bit if (!do_not_create_taskbar_
Joao da Silva
2013/03/06 21:21:33
Done (this was just setting it to false in that ca
gab
2013/03/06 23:18:16
Oh my bad, I had missed this change (had assumed t
| |
452 } | |
453 ExecuteAndLogShortcutOperation(ShellUtil::SHORTCUT_LOCATION_START_MENU, | |
454 dist, start_menu_properties, | |
455 shortcut_operation); | |
442 } | 456 } |
443 ExecuteAndLogShortcutOperation(ShellUtil::SHORTCUT_LOCATION_START_MENU, | |
444 dist, start_menu_properties, | |
445 shortcut_operation); | |
446 } | 457 } |
447 | 458 |
448 void RegisterChromeOnMachine(const InstallerState& installer_state, | 459 void RegisterChromeOnMachine(const InstallerState& installer_state, |
449 const Product& product, | 460 const Product& product, |
450 bool make_chrome_default) { | 461 bool make_chrome_default) { |
451 DCHECK(product.is_chrome()); | 462 DCHECK(product.is_chrome()); |
452 | 463 |
453 // Try to add Chrome to Media Player shim inclusion list. We don't do any | 464 // Try to add Chrome to Media Player shim inclusion list. We don't do any |
454 // error checking here because this operation will fail if user doesn't | 465 // error checking here because this operation will fail if user doesn't |
455 // have admin rights and we want to ignore the error. | 466 // have admin rights and we want to ignore the error. |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 if (app_host_path.empty()) | 690 if (app_host_path.empty()) |
680 return false; | 691 return false; |
681 | 692 |
682 CommandLine cmd(app_host_path); | 693 CommandLine cmd(app_host_path); |
683 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); | 694 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); |
684 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); | 695 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); |
685 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); | 696 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); |
686 } | 697 } |
687 | 698 |
688 } // namespace installer | 699 } // namespace installer |
OLD | NEW |