summaryrefslogtreecommitdiffstats
path: root/chrome/installer/setup
diff options
context:
space:
mode:
authorgab <gab@chromium.org>2015-07-27 10:28:21 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-27 17:28:55 +0000
commitbda290c881e5375992844e29f25cbea8408aa027 (patch)
tree9636e43557c195d8623202c4bc66d856d9ae6768 /chrome/installer/setup
parentf6a64d9a3c79ec02a618ff595551eedc35e6deaf (diff)
downloadchromium_src-bda290c881e5375992844e29f25cbea8408aa027.zip
chromium_src-bda290c881e5375992844e29f25cbea8408aa027.tar.gz
chromium_src-bda290c881e5375992844e29f25cbea8408aa027.tar.bz2
Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
BUG=503682 TBR=thakis@chromium.org (for method rename having side-effects in chrome/browser/ui and base/). Review URL: https://codereview.chromium.org/1242763002 Cr-Commit-Position: refs/heads/master@{#340493}
Diffstat (limited to 'chrome/installer/setup')
-rw-r--r--chrome/installer/setup/install.cc28
-rw-r--r--chrome/installer/setup/install_unittest.cc6
-rw-r--r--chrome/installer/setup/setup_main.cc4
-rw-r--r--chrome/installer/setup/uninstall.cc4
4 files changed, 27 insertions, 15 deletions
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index 00a74af..75eeb1a 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -100,11 +100,16 @@ void LogShortcutOperation(ShellUtil::ShortcutLocation location,
if (properties.pin_to_taskbar &&
base::win::GetVersion() >= base::win::VERSION_WIN7) {
- message.append(" and pinning to the taskbar.");
- } else {
- message.push_back('.');
+ message.append(" and pinning to the taskbar");
+ }
+
+ if (properties.pin_to_start &&
+ base::win::GetVersion() >= base::win::VERSION_WIN10) {
+ message.append(" and pinning to Start");
}
+ message.push_back('.');
+
if (failed)
LOG(WARNING) << message;
else
@@ -353,6 +358,7 @@ void CreateOrUpdateShortcuts(
bool do_not_create_desktop_shortcut = false;
bool do_not_create_quick_launch_shortcut = false;
bool do_not_create_taskbar_shortcut = false;
+ bool do_not_create_start_pin = false;
bool alternate_desktop_shortcut = false;
prefs.GetBool(master_preferences::kDoNotCreateDesktopShortcut,
&do_not_create_desktop_shortcut);
@@ -360,6 +366,8 @@ void CreateOrUpdateShortcuts(
&do_not_create_quick_launch_shortcut);
prefs.GetBool(master_preferences::kDoNotCreateTaskbarShortcut,
&do_not_create_taskbar_shortcut);
+ prefs.GetBool(master_preferences::kDoNotCreateStartPin,
+ &do_not_create_start_pin);
prefs.GetBool(master_preferences::kAltShortcutText,
&alternate_desktop_shortcut);
@@ -429,15 +437,15 @@ void CreateOrUpdateShortcuts(
ShellUtil::ShortcutProperties start_menu_properties(base_properties);
// IMPORTANT: Only the default (no arguments and default browserappid) browser
- // shortcut in the Start menu (Start screen on Win8+) should be considered for
- // dual mode.
+ // shortcut in the Start menu (Start screen on Win8+) should be made dual
+ // mode and that prior to Windows 10 only.
if (InstallUtil::ShouldInstallMetroProperties())
start_menu_properties.set_dual_mode(true);
- if (!do_not_create_taskbar_shortcut &&
- (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS ||
- shortcut_operation ==
- ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)) {
- start_menu_properties.set_pin_to_taskbar(true);
+ if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS ||
+ shortcut_operation ==
+ ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) {
+ start_menu_properties.set_pin_to_taskbar(!do_not_create_taskbar_shortcut);
+ start_menu_properties.set_pin_to_start(!do_not_create_start_pin);
}
ExecuteAndLogShortcutOperation(
ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist,
diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc
index 8c48202..dc9f5d1 100644
--- a/chrome/installer/setup/install_unittest.cc
+++ b/chrome/installer/setup/install_unittest.cc
@@ -144,8 +144,10 @@ class InstallShortcutTest : public testing::Test {
void TearDown() override {
// Try to unpin potentially pinned shortcuts (although pinning isn't tested,
// the call itself might still have pinned the Start Menu shortcuts).
- base::win::TaskbarUnpinShortcutLink(user_start_menu_shortcut_);
- base::win::TaskbarUnpinShortcutLink(system_start_menu_shortcut_);
+ base::win::UnpinShortcutFromTaskbar(user_start_menu_shortcut_);
+ base::win::UnpinShortcutFromTaskbar(system_start_menu_shortcut_);
+ base::win::UnpinShortcutFromStart(user_start_menu_shortcut_);
+ base::win::UnpinShortcutFromStart(system_start_menu_shortcut_);
CoUninitialize();
}
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index aac2781..571964c 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -877,12 +877,14 @@ installer::InstallStatus RegisterDevChrome(
if (base::PathExists(chrome_exe)) {
Product chrome(chrome_dist);
- // Create the Start menu shortcut and pin it to the taskbar.
+ // Create the Start menu shortcut and pin it to the Win7+ taskbar and Win10+
+ // start menu.
ShellUtil::ShortcutProperties shortcut_properties(ShellUtil::CURRENT_USER);
chrome.AddDefaultShortcutProperties(chrome_exe, &shortcut_properties);
if (InstallUtil::ShouldInstallMetroProperties())
shortcut_properties.set_dual_mode(true);
shortcut_properties.set_pin_to_taskbar(true);
+ shortcut_properties.set_pin_to_start(true);
ShellUtil::CreateOrUpdateShortcut(
ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, chrome_dist,
shortcut_properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS);
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index 4ba72dc..51799bb 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -337,11 +337,11 @@ void DeleteShortcuts(const InstallerState& installer_state,
// ShellUtil::ShortcutLocations.
VLOG(1) << "Deleting shortcuts.";
for (int location = ShellUtil::SHORTCUT_LOCATION_FIRST;
- location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) {
+ location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) {
if (!ShellUtil::RemoveShortcuts(
static_cast<ShellUtil::ShortcutLocation>(location), dist,
install_level, target_exe)) {
- LOG(WARNING) << "Failed to delete shortcuts in ShortcutLocation:"
+ LOG(WARNING) << "Failed to delete shortcuts in ShortcutLocation: "
<< location;
}
}