summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorpmonette <pmonette@chromium.org>2015-10-16 15:22:07 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-16 22:23:24 +0000
commit1568223f9d1a291c4800ef657c253dd96bb37fb0 (patch)
tree9cf4d70aed5e60fbb19a9e6e5b1a0c478c855387 /chrome/installer
parent9a57f509d0fa6722bb29925a8adb73185e48b619 (diff)
downloadchromium_src-1568223f9d1a291c4800ef657c253dd96bb37fb0.zip
chromium_src-1568223f9d1a291c4800ef657c253dd96bb37fb0.tar.gz
chromium_src-1568223f9d1a291c4800ef657c253dd96bb37fb0.tar.bz2
Reverted how taskbar pinning works.
The change was causing Chrome to chrash when pinning shortcuts because because of third-party shell extensions (See bug). Also removed the unused start menu pinning in Windows 10. Previous CLs: Changing pin to taskbar crrev.com/1193363003 Adding pin to start menu crrev.com/1242763002 BUG=540710 Review URL: https://codereview.chromium.org/1402003002 Cr-Commit-Position: refs/heads/master@{#354621}
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/setup/install.cc11
-rw-r--r--chrome/installer/setup/install_unittest.cc2
-rw-r--r--chrome/installer/setup/setup_main.cc4
-rw-r--r--chrome/installer/util/master_preferences_constants.cc1
-rw-r--r--chrome/installer/util/master_preferences_constants.h3
-rw-r--r--chrome/installer/util/master_preferences_unittest.cc17
-rw-r--r--chrome/installer/util/shell_util.cc19
-rw-r--r--chrome/installer/util/shell_util.h8
8 files changed, 6 insertions, 59 deletions
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index a076ca3..978646f 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -103,11 +103,6 @@ void LogShortcutOperation(ShellUtil::ShortcutLocation location,
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)
@@ -343,7 +338,6 @@ 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);
@@ -351,8 +345,6 @@ 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);
@@ -430,9 +422,6 @@ void CreateOrUpdateShortcuts(
shortcut_operation ==
ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) {
start_menu_properties.set_pin_to_taskbar(!do_not_create_taskbar_shortcut);
- // Disabled for now. TODO(gab): Remove this and the associated code if it
- // remains disabled long term.
- start_menu_properties.set_pin_to_start(false);
}
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 dc9f5d1..6f8b9c0 100644
--- a/chrome/installer/setup/install_unittest.cc
+++ b/chrome/installer/setup/install_unittest.cc
@@ -146,8 +146,6 @@ class InstallShortcutTest : public testing::Test {
// the call itself might still have pinned the Start Menu shortcuts).
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 d59c4d2..ae50659 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -985,14 +985,12 @@ installer::InstallStatus RegisterDevChrome(
if (base::PathExists(chrome_exe)) {
Product chrome(chrome_dist);
- // Create the Start menu shortcut and pin it to the Win7+ taskbar and Win10+
- // start menu.
+ // Create the Start menu shortcut and pin it to the Win7+ taskbar.
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/util/master_preferences_constants.cc b/chrome/installer/util/master_preferences_constants.cc
index d4d1809..4bcfd36 100644
--- a/chrome/installer/util/master_preferences_constants.cc
+++ b/chrome/installer/util/master_preferences_constants.cc
@@ -30,7 +30,6 @@ namespace master_preferences {
const char kDoNotCreateQuickLaunchShortcut[] =
"do_not_create_quick_launch_shortcut";
const char kDoNotCreateTaskbarShortcut[] = "do_not_create_taskbar_shortcut";
- const char kDoNotCreateStartPin[] = "do_not_create_start_pin";
const char kDoNotLaunchChrome[] = "do_not_launch_chrome";
const char kDoNotRegisterForUpdateLaunch[] =
"do_not_register_for_update_launch";
diff --git a/chrome/installer/util/master_preferences_constants.h b/chrome/installer/util/master_preferences_constants.h
index 5a37f42..bb53ae3 100644
--- a/chrome/installer/util/master_preferences_constants.h
+++ b/chrome/installer/util/master_preferences_constants.h
@@ -68,9 +68,6 @@ extern const char kDoNotCreateQuickLaunchShortcut[];
// Boolean. Prevent creation of the Taskbar (since Windows 7) shortcut on
// install (and later on Active Setup for each user on a system-level install).
extern const char kDoNotCreateTaskbarShortcut[];
-// Boolean. Prevent pinning Chrome to the Start Menu (since Windows 10) on
-// install (and later on Active Setup for each user on a system-level install).
-extern const char kDoNotCreateStartPin[];
// Boolean. Do not launch Chrome after first install. Cmd line override present.
extern const char kDoNotLaunchChrome[];
// Boolean. Do not register with Google Update to have Chrome launched after
diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc
index f077176..f524686 100644
--- a/chrome/installer/util/master_preferences_unittest.cc
+++ b/chrome/installer/util/master_preferences_unittest.cc
@@ -62,7 +62,6 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) {
" \"do_not_create_desktop_shortcut\": true,\n"
" \"do_not_create_quick_launch_shortcut\": true,\n"
" \"do_not_create_taskbar_shortcut\": true,\n"
- " \"do_not_create_start_pin\": true,\n"
" \"do_not_launch_chrome\": true,\n"
" \"make_chrome_default\": true,\n"
" \"make_chrome_default_for_user\": true,\n"
@@ -93,7 +92,6 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) {
installer::master_preferences::kDoNotCreateDesktopShortcut,
installer::master_preferences::kDoNotCreateQuickLaunchShortcut,
installer::master_preferences::kDoNotCreateTaskbarShortcut,
- installer::master_preferences::kDoNotCreateStartPin,
installer::master_preferences::kDoNotLaunchChrome,
installer::master_preferences::kMakeChromeDefault,
installer::master_preferences::kMakeChromeDefaultForUser,
@@ -350,7 +348,6 @@ TEST_F(MasterPreferencesTest, EnforceLegacyCreateAllShortcutsFalse) {
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;
prefs.GetBool(
installer::master_preferences::kDoNotCreateDesktopShortcut,
&do_not_create_desktop_shortcut);
@@ -360,16 +357,12 @@ TEST_F(MasterPreferencesTest, EnforceLegacyCreateAllShortcutsFalse) {
prefs.GetBool(
installer::master_preferences::kDoNotCreateTaskbarShortcut,
&do_not_create_taskbar_shortcut);
- prefs.GetBool(
- installer::master_preferences::kDoNotCreateStartPin,
- &do_not_create_start_pin);
// create_all_shortcuts is a legacy preference that should only enforce
// do_not_create_desktop_shortcut and do_not_create_quick_launch_shortcut
// when set to false.
EXPECT_TRUE(do_not_create_desktop_shortcut);
EXPECT_TRUE(do_not_create_quick_launch_shortcut);
EXPECT_FALSE(do_not_create_taskbar_shortcut);
- EXPECT_FALSE(do_not_create_start_pin);
}
TEST_F(MasterPreferencesTest, DontEnforceLegacyCreateAllShortcutsTrue) {
@@ -385,7 +378,6 @@ TEST_F(MasterPreferencesTest, DontEnforceLegacyCreateAllShortcutsTrue) {
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;
prefs.GetBool(
installer::master_preferences::kDoNotCreateDesktopShortcut,
&do_not_create_desktop_shortcut);
@@ -395,13 +387,9 @@ TEST_F(MasterPreferencesTest, DontEnforceLegacyCreateAllShortcutsTrue) {
prefs.GetBool(
installer::master_preferences::kDoNotCreateTaskbarShortcut,
&do_not_create_taskbar_shortcut);
- prefs.GetBool(
- installer::master_preferences::kDoNotCreateStartPin,
- &do_not_create_start_pin);
EXPECT_FALSE(do_not_create_desktop_shortcut);
EXPECT_FALSE(do_not_create_quick_launch_shortcut);
EXPECT_FALSE(do_not_create_taskbar_shortcut);
- EXPECT_FALSE(do_not_create_start_pin);
}
TEST_F(MasterPreferencesTest, DontEnforceLegacyCreateAllShortcutsNotSpecified) {
@@ -417,7 +405,6 @@ TEST_F(MasterPreferencesTest, DontEnforceLegacyCreateAllShortcutsNotSpecified) {
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;
prefs.GetBool(
installer::master_preferences::kDoNotCreateDesktopShortcut,
&do_not_create_desktop_shortcut);
@@ -427,13 +414,9 @@ TEST_F(MasterPreferencesTest, DontEnforceLegacyCreateAllShortcutsNotSpecified) {
prefs.GetBool(
installer::master_preferences::kDoNotCreateTaskbarShortcut,
&do_not_create_taskbar_shortcut);
- prefs.GetBool(
- installer::master_preferences::kDoNotCreateStartPin,
- &do_not_create_start_pin);
EXPECT_FALSE(do_not_create_desktop_shortcut);
EXPECT_FALSE(do_not_create_quick_launch_shortcut);
EXPECT_FALSE(do_not_create_taskbar_shortcut);
- EXPECT_FALSE(do_not_create_start_pin);
}
TEST_F(MasterPreferencesTest, MigrateOldStartupUrlsPref) {
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 37ecbcf..7f2eb14 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -1643,7 +1643,6 @@ ShellUtil::ShortcutProperties::ShortcutProperties(ShellChange level_in)
icon_index(0),
dual_mode(false),
pin_to_taskbar(false),
- pin_to_start(false),
options(0U) {}
ShellUtil::ShortcutProperties::~ShortcutProperties() {
@@ -1815,19 +1814,11 @@ bool ShellUtil::CreateOrUpdateShortcut(
*chosen_path, shortcut_properties, shortcut_operation);
}
- if (success && shortcut_operation == base::win::SHORTCUT_CREATE_ALWAYS) {
- if (properties.pin_to_taskbar &&
- base::win::GetVersion() >= base::win::VERSION_WIN7) {
- bool pinned = base::win::PinShortcutToTaskbar(*chosen_path);
- LOG_IF(ERROR, !pinned) << "Failed to pin to taskbar "
- << chosen_path->value();
- }
- if (properties.pin_to_start &&
- base::win::GetVersion() >= base::win::VERSION_WIN10) {
- bool pinned = base::win::PinShortcutToStart(*chosen_path);
- LOG_IF(ERROR, !pinned) << "Failed to pin to start "
- << chosen_path->value();
- }
+ if (success && shortcut_operation == base::win::SHORTCUT_CREATE_ALWAYS &&
+ properties.pin_to_taskbar && base::win::CanPinShortcutToTaskbar()) {
+ bool pinned = base::win::PinShortcutToTaskbar(*chosen_path);
+ LOG_IF(ERROR, !pinned) << "Failed to pin to taskbar "
+ << chosen_path->value();
}
return success;
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h
index 5b35e11..f13e2bb 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -163,13 +163,6 @@ class ShellUtil {
pin_to_taskbar = pin_to_taskbar_in;
}
- // Sets whether to pin this shortcut to the Win10+ start menu after creating
- // it (ignored if the shortcut is only being updated).
- // Note: This property doesn't have a mask in |options|.
- void set_pin_to_start(bool pin_to_start_in) {
- pin_to_start = pin_to_start_in;
- }
-
bool has_target() const {
return (options & PROPERTIES_TARGET) != 0;
}
@@ -211,7 +204,6 @@ class ShellUtil {
base::string16 shortcut_name;
bool dual_mode;
bool pin_to_taskbar;
- bool pin_to_start;
// Bitfield made of IndividualProperties. Properties set in |options| will
// be used to create/update the shortcut, others will be ignored on update
// and possibly replaced by default values on create (see individual