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/file_util.h" | 5 #include "base/file_util.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <propvarutil.h> | 8 #include <propvarutil.h> |
9 #include <psapi.h> | 9 #include <psapi.h> |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 431 |
432 HRESULT result = i_persist_file->Save(destination, TRUE); | 432 HRESULT result = i_persist_file->Save(destination, TRUE); |
433 | 433 |
434 // If we successfully updated the icon, notify the shell that we have done so. | 434 // If we successfully updated the icon, notify the shell that we have done so. |
435 if (!create && SUCCEEDED(result)) { | 435 if (!create && SUCCEEDED(result)) { |
436 // Release the interfaces in case the SHChangeNotify call below depends on | 436 // Release the interfaces in case the SHChangeNotify call below depends on |
437 // the operations above being fully completed. | 437 // the operations above being fully completed. |
438 i_persist_file.Release(); | 438 i_persist_file.Release(); |
439 i_shell_link.Release(); | 439 i_shell_link.Release(); |
440 | 440 |
441 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT, | 441 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); |
442 NULL, NULL); | |
443 } | 442 } |
444 | 443 |
445 return SUCCEEDED(result); | 444 return SUCCEEDED(result); |
446 } | 445 } |
447 | 446 |
448 bool TaskbarPinShortcutLink(const wchar_t* shortcut) { | 447 bool TaskbarPinShortcutLink(const wchar_t* shortcut) { |
449 base::ThreadRestrictions::AssertIOAllowed(); | 448 base::ThreadRestrictions::AssertIOAllowed(); |
450 | 449 |
451 // "Pin to taskbar" is only supported after Win7. | 450 // "Pin to taskbar" is only supported after Win7. |
452 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 451 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 HANDLE cp = GetCurrentProcess(); | 1107 HANDLE cp = GetCurrentProcess(); |
1109 if (::GetMappedFileNameW(cp, file_view, mapped_file_path, kMaxPathLength)) { | 1108 if (::GetMappedFileNameW(cp, file_view, mapped_file_path, kMaxPathLength)) { |
1110 *nt_path = FilePath(mapped_file_path); | 1109 *nt_path = FilePath(mapped_file_path); |
1111 success = true; | 1110 success = true; |
1112 } | 1111 } |
1113 ::UnmapViewOfFile(file_view); | 1112 ::UnmapViewOfFile(file_view); |
1114 return success; | 1113 return success; |
1115 } | 1114 } |
1116 | 1115 |
1117 } // namespace file_util | 1116 } // namespace file_util |
OLD | NEW |