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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 // information given through |properties|. | 110 // information given through |properties|. |
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 // Resolves 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. It should be non-0. The resulting data are read into |
125 // if all requested fields are found successfully. | 125 // |properties|, which must not be NULL. The function returns true if all |
126 // Callers can safely use the same variable for both |shortcut_path| and | 126 // requested properties are successfully read. Otherwise some reads have failed |
127 // |target_path|. | 127 // and intermediate values written to |properties| should be ignored. |
128 BASE_EXPORT bool ResolveShortcutProperties(const FilePath& shortcut_path, | |
129 uint32 options, | |
130 ShortcutProperties* properties); | |
131 | |
132 // Resolves Windows shortcut (.LNK file). | |
133 // This is a wrapper to ResolveShortcutProperties() to handle the common use | |
134 // case of resolving target and arguments. |target_path| and |args| are | |
135 // optional output variables that are ignored if NULL (but passing NULL to both | |
gab
2014/01/02 21:01:46
I'd change the the statement in () to:
(but at le
huangs
2014/01/02 23:22:37
Done.
| |
136 // triggers DCHECK). The function returns true if all requested fields are found | |
137 // successfully. Callers can safely use the same variable for both | |
138 // |shortcut_path| and |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 |