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 #ifndef BASE_WIN_SHORTCUT_H_ | 5 #ifndef BASE_WIN_SHORTCUT_H_ |
6 #define BASE_WIN_SHORTCUT_H_ | 6 #define BASE_WIN_SHORTCUT_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // Ensure you have initialized COM before calling into this function. | 111 // Ensure you have initialized COM before calling into this function. |
112 // |operation|: a choice from the ShortcutOperation enum. | 112 // |operation|: a choice from the ShortcutOperation enum. |
113 // If |operation| is SHORTCUT_REPLACE_EXISTING or SHORTCUT_UPDATE_EXISTING and | 113 // If |operation| is SHORTCUT_REPLACE_EXISTING or SHORTCUT_UPDATE_EXISTING and |
114 // |shortcut_path| does not exist, this method is a no-op and returns false. | 114 // |shortcut_path| does not exist, this method is a no-op and returns false. |
115 BASE_EXPORT bool CreateOrUpdateShortcutLink( | 115 BASE_EXPORT bool CreateOrUpdateShortcutLink( |
116 const FilePath& shortcut_path, | 116 const FilePath& shortcut_path, |
117 const ShortcutProperties& properties, | 117 const ShortcutProperties& properties, |
118 ShortcutOperation operation); | 118 ShortcutOperation operation); |
119 | 119 |
120 // Resolve Windows shortcut (.LNK file) | 120 // Resolve Windows shortcut (.LNK file) |
121 // This methods tries to resolve a shortcut .LNK file. The path of the shortcut | 121 // This methods tries to resolve selected properties of a shortcut .LNK file. |
122 // to resolve is in |shortcut_path|. If |target_path| is not NULL, the target | 122 // The path of the shortcut to resolve is in |shortcut_path|. |options| is a bit |
123 // will be resolved and placed in |target_path|. If |args| is not NULL, the | 123 // field composed of ShortcutProperties::IndividualProperties, to specify which |
124 // arguments will be retrieved and placed in |args|. The function returns true | 124 // properties to read. The resulting data are read into |p| (non-NULL). The |
125 // if all requested fields are found successfully. | 125 // function returns true if all requested properties are successfully read. |
| 126 // Otherwise some reads have failed, and intermediate values written to |
| 127 // |properties| should be ignored. |
| 128 BASE_EXPORT bool ResolveShortcutProperties(const FilePath& shortcut_path, |
| 129 uint32 options, |
| 130 ShortcutProperties* p); |
| 131 |
| 132 // Resolve Windows shortcut (.LNK file). |
| 133 // This is a wrapper to ResolveShortcutProperties() to handle the commonly used |
| 134 // cases of resolving target and arguments. |target_path| and |args| are |
| 135 // optional output variables that are ignored if NULL. |
| 136 // The function returns true if all requested fields are found successfully. |
126 // Callers can safely use the same variable for both |shortcut_path| and | 137 // Callers can safely use the same variable for both |shortcut_path| and |
127 // |target_path|. | 138 // |target_path|. |
128 BASE_EXPORT bool ResolveShortcut(const FilePath& shortcut_path, | 139 BASE_EXPORT bool ResolveShortcut(const FilePath& shortcut_path, |
129 FilePath* target_path, | 140 FilePath* target_path, |
130 string16* args); | 141 string16* args); |
131 | 142 |
132 // Pins a shortcut to the Windows 7 taskbar. The shortcut file must already | 143 // Pins a shortcut to the Windows 7 taskbar. The shortcut file must already |
133 // exist and be a shortcut that points to an executable. The app id of the | 144 // exist and be a shortcut that points to an executable. The app id of the |
134 // shortcut is used to group windows and must be set correctly. | 145 // shortcut is used to group windows and must be set correctly. |
135 BASE_EXPORT bool TaskbarPinShortcutLink(const wchar_t* shortcut); | 146 BASE_EXPORT bool TaskbarPinShortcutLink(const wchar_t* shortcut); |
136 | 147 |
137 // Unpins a shortcut from the Windows 7 taskbar. The shortcut must exist and | 148 // Unpins a shortcut from the Windows 7 taskbar. The shortcut must exist and |
138 // already be pinned to the taskbar. The app id of the shortcut is used as the | 149 // already be pinned to the taskbar. The app id of the shortcut is used as the |
139 // identifier for the taskbar item to remove and must be set correctly. | 150 // identifier for the taskbar item to remove and must be set correctly. |
140 BASE_EXPORT bool TaskbarUnpinShortcutLink(const wchar_t* shortcut); | 151 BASE_EXPORT bool TaskbarUnpinShortcutLink(const wchar_t* shortcut); |
141 | 152 |
142 } // namespace win | 153 } // namespace win |
143 } // namespace base | 154 } // namespace base |
144 | 155 |
145 #endif // BASE_WIN_SHORTCUT_H_ | 156 #endif // BASE_WIN_SHORTCUT_H_ |
OLD | NEW |