diff options
author | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-10 23:41:25 +0000 |
---|---|---|
committer | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-10 23:41:25 +0000 |
commit | f2dd36c4bbe5926db2bf49741a50883610ff4137 (patch) | |
tree | 87f4e1f9ac3d4b9955bae7c3d5b16f629c6f7501 /base/file_util.h | |
parent | a99b6224b92e7dc822cd52d685a70194694e4074 (diff) | |
download | chromium_src-f2dd36c4bbe5926db2bf49741a50883610ff4137.zip chromium_src-f2dd36c4bbe5926db2bf49741a50883610ff4137.tar.gz chromium_src-f2dd36c4bbe5926db2bf49741a50883610ff4137.tar.bz2 |
Refactoring and tests for the highly undertested file_util::CreateOrUpdateShortcutLink() method.
Simplify file_util::CreateOrUpdateShortcutLink()'s interface (use a struct to set parameters passed which allows callers to specify exactly what they want without having to pass in a bunch of NULLs for the unused parameters).
The same concept will be used for ShellUtil's shortcut functions in an upcoming CL.
Moved ShellUtil::VerifyChromeShortcut() to file_util::VerifyShortcut() and augmented it for every shortcut properties. This will also allow other shortcut creators (web apps, profiles, etc.) to have a broader test coverage on the shortcut they create (i.e. more testable properties available).
I will leave it up to the owners of these various projects to augment their tests, this CL keeps the previously tested behavior, not more, not less.
This is the 1st CL of a massive refactoring effort for shortcuts (http://goo.gl/Az889) in which ShellUtil's shortcut methods have to be refactored (http://codereview.chromium.org/10836247/ : soon to incorporate interface changes from this CL) which led me even lower to first refactor file_util's shortcut methods.
BUG=132825
TEST=base_unittests --gtest_filter=FileUtilShortcutTest*
installer_util_unitests --gtest_filter=ShellUtilTestWithDirAndDist*
unit_tests --gtest_filter=ProfileShortcutManagerTest*
Review URL: https://chromiumcodereview.appspot.com/10914109
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155869 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.h')
-rw-r--r-- | base/file_util.h | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/base/file_util.h b/base/file_util.h index 66fe51c..e6fad43 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -226,57 +226,6 @@ BASE_EXPORT bool SetPosixFilePermissions(const FilePath& path, #endif // defined(OS_POSIX) #if defined(OS_WIN) -enum ShortcutOptions { - SHORTCUT_NO_OPTIONS = 0, - // Set DualMode property for Windows 8 Metro-enabled shortcuts. - SHORTCUT_DUAL_MODE = 1 << 0, - // Create a new shortcut (overwriting if necessary). - SHORTCUT_CREATE_ALWAYS = 1 << 1, -}; - -// Resolve Windows shortcut (.LNK file) -// This methods tries to resolve a shortcut .LNK file. The path of the shortcut -// to resolve is in |shortcut_path|. If |target_path| is not NULL, the target -// will be resolved and placed in |target_path|. If |args| is not NULL, the -// arguments will be retrieved and placed in |args|. The function returns true -// if all requested fields are are found successfully. -// Callers can safely use the same variable for both |shortcut_path| and -// |target_path|. -BASE_EXPORT bool ResolveShortcut(const FilePath& shortcut_path, - FilePath* target_path, - string16* args); - -// Creates (or updates) a Windows shortcut (.LNK file) -// This method creates (or updates) a shortcut link using the information given. -// Ensure you have initialized COM before calling into this function. -// |destination| is required. |source| is required when SHORTCUT_CREATE_ALWAYS -// is specified in |options|. All other parameters are optional and may be NULL. -// |source| is the existing file, |destination| is the new link file to be -// created; for best results pass the filename with the .lnk extension. -// The |icon| can specify a dll or exe in which case the icon index is the -// resource id. |app_id| is the app model id for the shortcut on Win7. -// |options|: bitfield for which the options come from ShortcutOptions. -// If SHORTCUT_CREATE_ALWAYS is not set in |options|, only specified (non-null) -// properties on an existing shortcut will be modified. If the shortcut does not -// exist, this method is a no-op and returns false. -BASE_EXPORT bool CreateOrUpdateShortcutLink(const wchar_t *source, - const wchar_t *destination, - const wchar_t *working_dir, - const wchar_t *arguments, - const wchar_t *description, - const wchar_t *icon, - int icon_index, - const wchar_t* app_id, - uint32 options); - -// Pins a shortcut to the Windows 7 taskbar. The shortcut file must already -// exist and be a shortcut that points to an executable. -BASE_EXPORT bool TaskbarPinShortcutLink(const wchar_t* shortcut); - -// Unpins a shortcut from the Windows 7 taskbar. The shortcut must exist and -// already be pinned to the taskbar. -BASE_EXPORT bool TaskbarUnpinShortcutLink(const wchar_t* shortcut); - // Copy from_path to to_path recursively and then delete from_path recursively. // Returns true if all operations succeed. // This function simulates Move(), but unlike Move() it works across volumes. |