| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 ShortcutOperation operation) { | 46 ShortcutOperation operation) { |
| 47 base::ThreadRestrictions::AssertIOAllowed(); | 47 base::ThreadRestrictions::AssertIOAllowed(); |
| 48 | 48 |
| 49 // A target is required unless |operation| is SHORTCUT_UPDATE_EXISTING. | 49 // A target is required unless |operation| is SHORTCUT_UPDATE_EXISTING. |
| 50 if (operation != SHORTCUT_UPDATE_EXISTING && | 50 if (operation != SHORTCUT_UPDATE_EXISTING && |
| 51 !(properties.options & ShortcutProperties::PROPERTIES_TARGET)) { | 51 !(properties.options & ShortcutProperties::PROPERTIES_TARGET)) { |
| 52 NOTREACHED(); | 52 NOTREACHED(); |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool shortcut_existed = file_util::PathExists(shortcut_path); | 56 bool shortcut_existed = PathExists(shortcut_path); |
| 57 | 57 |
| 58 // Interfaces to the old shortcut when replacing an existing shortcut. | 58 // Interfaces to the old shortcut when replacing an existing shortcut. |
| 59 ScopedComPtr<IShellLink> old_i_shell_link; | 59 ScopedComPtr<IShellLink> old_i_shell_link; |
| 60 ScopedComPtr<IPersistFile> old_i_persist_file; | 60 ScopedComPtr<IPersistFile> old_i_persist_file; |
| 61 | 61 |
| 62 // Interfaces to the shortcut being created/updated. | 62 // Interfaces to the shortcut being created/updated. |
| 63 ScopedComPtr<IShellLink> i_shell_link; | 63 ScopedComPtr<IShellLink> i_shell_link; |
| 64 ScopedComPtr<IPersistFile> i_persist_file; | 64 ScopedComPtr<IPersistFile> i_persist_file; |
| 65 switch (operation) { | 65 switch (operation) { |
| 66 case SHORTCUT_CREATE_ALWAYS: | 66 case SHORTCUT_CREATE_ALWAYS: |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 240 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
| 241 return false; | 241 return false; |
| 242 | 242 |
| 243 int result = reinterpret_cast<int>(ShellExecute(NULL, L"taskbarunpin", | 243 int result = reinterpret_cast<int>(ShellExecute(NULL, L"taskbarunpin", |
| 244 shortcut, NULL, NULL, 0)); | 244 shortcut, NULL, NULL, 0)); |
| 245 return result > 32; | 245 return result > 32; |
| 246 } | 246 } |
| 247 | 247 |
| 248 } // namespace win | 248 } // namespace win |
| 249 } // namespace base | 249 } // namespace base |
| OLD | NEW |