diff options
author | pauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-14 17:58:36 +0000 |
---|---|---|
committer | pauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-14 17:58:36 +0000 |
commit | 3ae13e0deb8744e78cb8827c44d1247b37a1cd6e (patch) | |
tree | 51fc3a31b155f1d04653a436122e3b4603e23a32 /chrome/installer | |
parent | d9e601a1cbce07c4733f54fafdc6f0b2d213df05 (diff) | |
download | chromium_src-3ae13e0deb8744e78cb8827c44d1247b37a1cd6e.zip chromium_src-3ae13e0deb8744e78cb8827c44d1247b37a1cd6e.tar.gz chromium_src-3ae13e0deb8744e78cb8827c44d1247b37a1cd6e.tar.bz2 |
Revert 244708 "Manual profile reset: reset shortcuts on Windows."
Looks like it causes ProfileSettingsResetWebUITest.testOpenProfileSettingsReset to fail most of the time.
> Manual profile reset: reset shortcuts on Windows.
>
> BUG=324931
>
> Review URL: https://codereview.chromium.org/116143003
TBR=vasilii@chromium.org
Review URL: https://codereview.chromium.org/134873009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244766 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r-- | chrome/installer/util/shell_util.cc | 50 | ||||
-rw-r--r-- | chrome/installer/util/shell_util.h | 12 | ||||
-rw-r--r-- | chrome/installer/util/shell_util_unittest.cc | 95 |
3 files changed, 0 insertions, 157 deletions
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index c6ae322..f5e3851 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -30,7 +30,6 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "base/win/registry.h" @@ -1293,37 +1292,6 @@ bool ShortcutOpRetarget(const base::FilePath& old_target, return result; } -bool ShortcutOpListOrRemoveUnknownArgs( - bool do_removal, - std::vector<std::pair<base::FilePath, base::string16> >* shortcuts, - const base::FilePath& shortcut_path) { - base::string16 args; - if (!base::win::ResolveShortcut(shortcut_path, NULL, &args)) - return false; - - CommandLine current_args(CommandLine::FromString(base::StringPrintf( - L"unused_program %ls", args.c_str()))); - const char* const kept_switches[] = { - switches::kApp, - switches::kAppId, - switches::kShowAppList, - switches::kProfileDirectory, - }; - CommandLine desired_args(CommandLine::NO_PROGRAM); - desired_args.CopySwitchesFrom(current_args, kept_switches, - arraysize(kept_switches)); - if (desired_args.argv().size() == current_args.argv().size()) - return true; - if (shortcuts) - shortcuts->push_back(std::make_pair(shortcut_path, args)); - if (!do_removal) - return true; - base::win::ShortcutProperties updated_properties; - updated_properties.set_arguments(desired_args.GetArgumentsString()); - return base::win::CreateOrUpdateShortcutLink( - shortcut_path, updated_properties, base::win::SHORTCUT_UPDATE_EXISTING); -} - // {|location|, |dist|, |level|} determine |shortcut_folder|. // For each shortcut in |shortcut_folder| that match |shortcut_filter|, apply // |shortcut_operation|. Returns true if all operations are successful. @@ -2169,24 +2137,6 @@ bool ShellUtil::RetargetShortcutsWithArgs( shortcut_operation, location, dist, level); } -// static -bool ShellUtil::ShortcutListMaybeRemoveUnknownArgs( - ShellUtil::ShortcutLocation location, - BrowserDistribution* dist, - ShellChange level, - const base::FilePath& chrome_exe, - bool do_removal, - std::vector<std::pair<base::FilePath, base::string16> >* shortcuts) { - if (!ShellUtil::ShortcutLocationIsSupported(location)) - return false; - DCHECK(dist); - FilterTargetEq shortcut_filter(chrome_exe, true); - ShortcutOperationCallback shortcut_operation( - base::Bind(&ShortcutOpListOrRemoveUnknownArgs, do_removal, shortcuts)); - return BatchShortcutAction(shortcut_filter.AsShortcutFilterCallback(), - shortcut_operation, location, dist, level); -} - bool ShellUtil::GetUserSpecificRegistrySuffix(base::string16* suffix) { // Use a thread-safe cache for the user's suffix. static base::LazyInstance<UserSpecificRegistrySuffix>::Leaky suffix_instance = diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h index fccd39c..868a275 100644 --- a/chrome/installer/util/shell_util.h +++ b/chrome/installer/util/shell_util.h @@ -12,7 +12,6 @@ #include <windows.h> #include <map> -#include <utility> #include <vector> #include "base/basictypes.h" @@ -545,17 +544,6 @@ class ShellUtil { const base::FilePath& old_target_exe, const base::FilePath& new_target_exe); - // Appends Chrome shortcuts with non-whitelisted arguments to |shortcuts| if - // not NULL. If |do_removal|, also removes non-whitelisted arguments from - // those shortcuts. - static bool ShortcutListMaybeRemoveUnknownArgs( - ShellUtil::ShortcutLocation location, - BrowserDistribution* dist, - ShellChange level, - const base::FilePath& chrome_exe, - bool do_removal, - std::vector<std::pair<base::FilePath, base::string16> >* shortcuts); - // Sets |suffix| to the base 32 encoding of the md5 hash of this user's sid // preceded by a dot. // This is guaranteed to be unique on the machine and 27 characters long diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index 20d23b5..76ed7de5 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc @@ -590,101 +590,6 @@ TEST_F(ShellUtilShortcutTest, RetargetChromeShortcutsWithArgsIcon) { expected_properties3); } -TEST_F(ShellUtilShortcutTest, ClearShortcutArguments) { - // Shortcut 1: targets "chrome.exe"; no arguments. - test_properties_.set_shortcut_name(L"Chrome 1"); - test_properties_.set_arguments(L""); - ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, - ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - base::FilePath shortcut1_path = GetExpectedShortcutPath( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_); - ASSERT_TRUE(base::PathExists(shortcut1_path)); - ShellUtil::ShortcutProperties expected_properties1(test_properties_); - - // Shortcut 2: targets "chrome.exe"; has 1 whitelisted argument. - test_properties_.set_shortcut_name(L"Chrome 2"); - test_properties_.set_arguments(L"--profile-directory=\"Profile 2\""); - ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, - ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - base::FilePath shortcut2_path = GetExpectedShortcutPath( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_); - ASSERT_TRUE(base::PathExists(shortcut2_path)); - ShellUtil::ShortcutProperties expected_properties2(test_properties_); - - // Shortcut 3: targets "chrome.exe"; has an unknown argument. - test_properties_.set_shortcut_name(L"Chrome 3"); - test_properties_.set_arguments(L"foo.com"); - ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, - ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - base::FilePath shortcut3_path = GetExpectedShortcutPath( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_); - ASSERT_TRUE(base::PathExists(shortcut3_path)); - ShellUtil::ShortcutProperties expected_properties3(test_properties_); - - // Shortcut 4: targets "chrome.exe"; has both unknown and known arguments. - test_properties_.set_shortcut_name(L"Chrome 4"); - test_properties_.set_arguments(L"foo.com --show-app-list"); - ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, - ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - base::FilePath shortcut4_path = GetExpectedShortcutPath( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_); - ASSERT_TRUE(base::PathExists(shortcut4_path)); - ShellUtil::ShortcutProperties expected_properties4(test_properties_); - - // List the shortcuts. - std::vector<std::pair<base::FilePath, base::string16> > shortcuts; - EXPECT_TRUE(ShellUtil::ShortcutListMaybeRemoveUnknownArgs( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, - dist_, - ShellUtil::CURRENT_USER, - chrome_exe_, - false, - &shortcuts)); - ASSERT_EQ(2u, shortcuts.size()); - std::pair<base::FilePath, base::string16> shortcut3 = - shortcuts[0].first == shortcut3_path ? shortcuts[0] : shortcuts[1]; - std::pair<base::FilePath, base::string16> shortcut4 = - shortcuts[0].first == shortcut4_path ? shortcuts[0] : shortcuts[1]; - EXPECT_EQ(shortcut3_path, shortcut3.first); - EXPECT_EQ(L"foo.com", shortcut3.second); - EXPECT_EQ(shortcut4_path, shortcut4.first); - EXPECT_EQ(L"foo.com --show-app-list", shortcut4.second); - - // Clear shortcuts. - shortcuts.clear(); - EXPECT_TRUE(ShellUtil::ShortcutListMaybeRemoveUnknownArgs( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, - dist_, - ShellUtil::CURRENT_USER, - chrome_exe_, - true, - &shortcuts)); - ASSERT_EQ(2u, shortcuts.size()); - shortcut3 = shortcuts[0].first == shortcut3_path ? shortcuts[0] : - shortcuts[1]; - shortcut4 = shortcuts[0].first == shortcut4_path ? shortcuts[0] : - shortcuts[1]; - EXPECT_EQ(shortcut3_path, shortcut3.first); - EXPECT_EQ(L"foo.com", shortcut3.second); - EXPECT_EQ(shortcut4_path, shortcut4.first); - EXPECT_EQ(L"foo.com --show-app-list", shortcut4.second); - - ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, - expected_properties1); - ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, - expected_properties2); - expected_properties3.set_arguments(base::string16()); - ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, - expected_properties3); - expected_properties4.set_arguments(L"--show-app-list"); - ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, - expected_properties4); -} - TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |