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 #include "base/win/shortcut.h" | 5 #include "base/win/shortcut.h" |
6 | 6 |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 #include <propkey.h> | 9 #include <propkey.h> |
10 | 10 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } else { | 176 } else { |
177 SHChangeNotify(SHCNE_CREATE, SHCNF_PATH, shortcut_path.value().c_str(), | 177 SHChangeNotify(SHCNE_CREATE, SHCNF_PATH, shortcut_path.value().c_str(), |
178 NULL); | 178 NULL); |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 return succeeded; | 182 return succeeded; |
183 } | 183 } |
184 | 184 |
185 bool ResolveShortcutProperties(const FilePath& shortcut_path, | 185 bool ResolveShortcutProperties(const FilePath& shortcut_path, |
186 uint32 options, | 186 uint32_t options, |
187 ShortcutProperties* properties) { | 187 ShortcutProperties* properties) { |
188 DCHECK(options && properties); | 188 DCHECK(options && properties); |
189 base::ThreadRestrictions::AssertIOAllowed(); | 189 base::ThreadRestrictions::AssertIOAllowed(); |
190 | 190 |
191 if (options & ~ShortcutProperties::PROPERTIES_ALL) | 191 if (options & ~ShortcutProperties::PROPERTIES_ALL) |
192 NOTREACHED() << "Unhandled property is used."; | 192 NOTREACHED() << "Unhandled property is used."; |
193 | 193 |
194 ScopedComPtr<IShellLink> i_shell_link; | 194 ScopedComPtr<IShellLink> i_shell_link; |
195 | 195 |
196 // Get pointer to the IShellLink interface. | 196 // Get pointer to the IShellLink interface. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 289 } |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 return true; | 293 return true; |
294 } | 294 } |
295 | 295 |
296 bool ResolveShortcut(const FilePath& shortcut_path, | 296 bool ResolveShortcut(const FilePath& shortcut_path, |
297 FilePath* target_path, | 297 FilePath* target_path, |
298 string16* args) { | 298 string16* args) { |
299 uint32 options = 0; | 299 uint32_t options = 0; |
300 if (target_path) | 300 if (target_path) |
301 options |= ShortcutProperties::PROPERTIES_TARGET; | 301 options |= ShortcutProperties::PROPERTIES_TARGET; |
302 if (args) | 302 if (args) |
303 options |= ShortcutProperties::PROPERTIES_ARGUMENTS; | 303 options |= ShortcutProperties::PROPERTIES_ARGUMENTS; |
304 DCHECK(options); | 304 DCHECK(options); |
305 | 305 |
306 ShortcutProperties properties; | 306 ShortcutProperties properties; |
307 if (!ResolveShortcutProperties(shortcut_path, options, &properties)) | 307 if (!ResolveShortcutProperties(shortcut_path, options, &properties)) |
308 return false; | 308 return false; |
309 | 309 |
(...skipping 27 matching lines...) Expand all Loading... |
337 if (GetVersion() < VERSION_WIN7) | 337 if (GetVersion() < VERSION_WIN7) |
338 return false; | 338 return false; |
339 | 339 |
340 intptr_t result = reinterpret_cast<intptr_t>(ShellExecute( | 340 intptr_t result = reinterpret_cast<intptr_t>(ShellExecute( |
341 NULL, L"taskbarunpin", shortcut.value().c_str(), NULL, NULL, 0)); | 341 NULL, L"taskbarunpin", shortcut.value().c_str(), NULL, NULL, 0)); |
342 return result > 32; | 342 return result > 32; |
343 } | 343 } |
344 | 344 |
345 } // namespace win | 345 } // namespace win |
346 } // namespace base | 346 } // namespace base |
OLD | NEW |