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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // information given through |properties|. | 118 // information given through |properties|. |
119 // Ensure you have initialized COM before calling into this function. | 119 // Ensure you have initialized COM before calling into this function. |
120 // |operation|: a choice from the ShortcutOperation enum. | 120 // |operation|: a choice from the ShortcutOperation enum. |
121 // If |operation| is SHORTCUT_REPLACE_EXISTING or SHORTCUT_UPDATE_EXISTING and | 121 // If |operation| is SHORTCUT_REPLACE_EXISTING or SHORTCUT_UPDATE_EXISTING and |
122 // |shortcut_path| does not exist, this method is a no-op and returns false. | 122 // |shortcut_path| does not exist, this method is a no-op and returns false. |
123 BASE_EXPORT bool CreateOrUpdateShortcutLink( | 123 BASE_EXPORT bool CreateOrUpdateShortcutLink( |
124 const FilePath& shortcut_path, | 124 const FilePath& shortcut_path, |
125 const ShortcutProperties& properties, | 125 const ShortcutProperties& properties, |
126 ShortcutOperation operation); | 126 ShortcutOperation operation); |
127 | 127 |
128 // Resolves Windows shortcut (.LNK file) | 128 // Resolves Windows shortcut (.LNK file). |
129 // This methods tries to resolve selected properties of a shortcut .LNK file. | 129 // This methods tries to resolve selected properties of a shortcut .LNK file. |
130 // The path of the shortcut to resolve is in |shortcut_path|. |options| is a bit | 130 // The path of the shortcut to resolve is in |shortcut_path|. |options| is a bit |
131 // field composed of ShortcutProperties::IndividualProperties, to specify which | 131 // field composed of ShortcutProperties::IndividualProperties, to specify which |
132 // properties to read. It should be non-0. The resulting data are read into | 132 // properties to read. It should be non-0. The resulting data are read into |
133 // |properties|, which must not be NULL. The function returns true if all | 133 // |properties|, which must not be NULL. Note: PROPERTIES_TARGET will retrieve |
134 // requested properties are successfully read. Otherwise some reads have failed | 134 // the target path as stored in the shortcut but won't attempt to resolve that |
135 // and intermediate values written to |properties| should be ignored. | 135 // path so it may not be valid. The function returns true if all requested |
| 136 // properties are successfully read. Otherwise some reads have failed and |
| 137 // intermediate values written to |properties| should be ignored. |
136 BASE_EXPORT bool ResolveShortcutProperties(const FilePath& shortcut_path, | 138 BASE_EXPORT bool ResolveShortcutProperties(const FilePath& shortcut_path, |
137 uint32 options, | 139 uint32 options, |
138 ShortcutProperties* properties); | 140 ShortcutProperties* properties); |
139 | 141 |
140 // Resolves Windows shortcut (.LNK file). | 142 // Resolves Windows shortcut (.LNK file). |
141 // This is a wrapper to ResolveShortcutProperties() to handle the common use | 143 // This is a wrapper to ResolveShortcutProperties() to handle the common use |
142 // case of resolving target and arguments. |target_path| and |args| are | 144 // case of resolving target and arguments. |target_path| and |args| are |
143 // optional output variables that are ignored if NULL (but at least one must be | 145 // optional output variables that are ignored if NULL (but at least one must be |
144 // non-NULL). The function returns true if all requested fields are found | 146 // non-NULL). The function returns true if all requested fields are found |
145 // successfully. Callers can safely use the same variable for both | 147 // successfully. Callers can safely use the same variable for both |
146 // |shortcut_path| and |target_path|. | 148 // |shortcut_path| and |target_path|. |
147 BASE_EXPORT bool ResolveShortcut(const FilePath& shortcut_path, | 149 BASE_EXPORT bool ResolveShortcut(const FilePath& shortcut_path, |
148 FilePath* target_path, | 150 FilePath* target_path, |
149 string16* args); | 151 string16* args); |
150 | 152 |
151 // Pins a shortcut to the Windows 7 taskbar. The shortcut file must already | 153 // Pins a shortcut to the Windows 7 taskbar. The shortcut file must already |
152 // exist and be a shortcut that points to an executable. The app id of the | 154 // exist and be a shortcut that points to an executable. The app id of the |
153 // shortcut is used to group windows and must be set correctly. | 155 // shortcut is used to group windows and must be set correctly. |
154 BASE_EXPORT bool TaskbarPinShortcutLink(const wchar_t* shortcut); | 156 BASE_EXPORT bool TaskbarPinShortcutLink(const wchar_t* shortcut); |
155 | 157 |
156 // Unpins a shortcut from the Windows 7 taskbar. The shortcut must exist and | 158 // Unpins a shortcut from the Windows 7 taskbar. The shortcut must exist and |
157 // already be pinned to the taskbar. The app id of the shortcut is used as the | 159 // already be pinned to the taskbar. The app id of the shortcut is used as the |
158 // identifier for the taskbar item to remove and must be set correctly. | 160 // identifier for the taskbar item to remove and must be set correctly. |
159 BASE_EXPORT bool TaskbarUnpinShortcutLink(const wchar_t* shortcut); | 161 BASE_EXPORT bool TaskbarUnpinShortcutLink(const wchar_t* shortcut); |
160 | 162 |
161 } // namespace win | 163 } // namespace win |
162 } // namespace base | 164 } // namespace base |
163 | 165 |
164 #endif // BASE_WIN_SHORTCUT_H_ | 166 #endif // BASE_WIN_SHORTCUT_H_ |
OLD | NEW |