| 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 24 matching lines...) Expand all Loading... |
| 35 CLSCTX_INPROC_SERVER)) || | 35 CLSCTX_INPROC_SERVER)) || |
| 36 FAILED(i_persist_file->QueryFrom(i_shell_link->get())) || | 36 FAILED(i_persist_file->QueryFrom(i_shell_link->get())) || |
| 37 (shortcut && FAILED((*i_persist_file)->Load(shortcut, STGM_READWRITE)))) { | 37 (shortcut && FAILED((*i_persist_file)->Load(shortcut, STGM_READWRITE)))) { |
| 38 i_shell_link->Release(); | 38 i_shell_link->Release(); |
| 39 i_persist_file->Release(); | 39 i_persist_file->Release(); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 ShortcutProperties::ShortcutProperties() |
| 46 : icon_index(-1), dual_mode(false), options(0U) { |
| 47 } |
| 48 |
| 49 ShortcutProperties::~ShortcutProperties() { |
| 50 } |
| 51 |
| 45 bool CreateOrUpdateShortcutLink(const FilePath& shortcut_path, | 52 bool CreateOrUpdateShortcutLink(const FilePath& shortcut_path, |
| 46 const ShortcutProperties& properties, | 53 const ShortcutProperties& properties, |
| 47 ShortcutOperation operation) { | 54 ShortcutOperation operation) { |
| 48 base::ThreadRestrictions::AssertIOAllowed(); | 55 base::ThreadRestrictions::AssertIOAllowed(); |
| 49 | 56 |
| 50 // A target is required unless |operation| is SHORTCUT_UPDATE_EXISTING. | 57 // A target is required unless |operation| is SHORTCUT_UPDATE_EXISTING. |
| 51 if (operation != SHORTCUT_UPDATE_EXISTING && | 58 if (operation != SHORTCUT_UPDATE_EXISTING && |
| 52 !(properties.options & ShortcutProperties::PROPERTIES_TARGET)) { | 59 !(properties.options & ShortcutProperties::PROPERTIES_TARGET)) { |
| 53 NOTREACHED(); | 60 NOTREACHED(); |
| 54 return false; | 61 return false; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 if (GetVersion() < VERSION_WIN7) | 333 if (GetVersion() < VERSION_WIN7) |
| 327 return false; | 334 return false; |
| 328 | 335 |
| 329 int result = reinterpret_cast<int>(ShellExecute(NULL, L"taskbarunpin", | 336 int result = reinterpret_cast<int>(ShellExecute(NULL, L"taskbarunpin", |
| 330 shortcut, NULL, NULL, 0)); | 337 shortcut, NULL, NULL, 0)); |
| 331 return result > 32; | 338 return result > 32; |
| 332 } | 339 } |
| 333 | 340 |
| 334 } // namespace win | 341 } // namespace win |
| 335 } // namespace base | 342 } // namespace base |
| OLD | NEW |