| 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 "chrome/browser/shell_integration_win.h" | 5 #include "chrome/browser/shell_integration_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <objbase.h> |
| 8 #include <shlwapi.h> | 9 #include <shlwapi.h> |
| 9 #include <shobjidl.h> | 10 #include <shobjidl.h> |
| 10 #include <propkey.h> // Needs to come after shobjidl.h. | 11 #include <propkey.h> // Needs to come after shobjidl.h. |
| 11 #include <stddef.h> | 12 #include <stddef.h> |
| 12 #include <stdint.h> | 13 #include <stdint.h> |
| 13 | 14 |
| 14 #include <memory> | 15 #include <memory> |
| 15 #include <utility> | 16 #include <utility> |
| 16 #include <vector> | 17 #include <vector> |
| 17 | 18 |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 | 776 |
| 776 // Get the expected AppId for this Chrome shortcut. | 777 // Get the expected AppId for this Chrome shortcut. |
| 777 base::string16 expected_app_id( | 778 base::string16 expected_app_id( |
| 778 GetExpectedAppId(command_line, is_per_user_install)); | 779 GetExpectedAppId(command_line, is_per_user_install)); |
| 779 if (expected_app_id.empty()) | 780 if (expected_app_id.empty()) |
| 780 continue; | 781 continue; |
| 781 | 782 |
| 782 // Load the shortcut. | 783 // Load the shortcut. |
| 783 base::win::ScopedComPtr<IShellLink> shell_link; | 784 base::win::ScopedComPtr<IShellLink> shell_link; |
| 784 base::win::ScopedComPtr<IPersistFile> persist_file; | 785 base::win::ScopedComPtr<IPersistFile> persist_file; |
| 785 if (FAILED(shell_link.CreateInstance(CLSID_ShellLink, NULL, | 786 if (FAILED(::CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, |
| 786 CLSCTX_INPROC_SERVER)) || | 787 IID_PPV_ARGS(&shell_link))) || |
| 787 FAILED(shell_link.CopyTo(persist_file.GetAddressOf())) || | 788 FAILED(shell_link.CopyTo(persist_file.GetAddressOf())) || |
| 788 FAILED(persist_file->Load(shortcut.value().c_str(), STGM_READ))) { | 789 FAILED(persist_file->Load(shortcut.value().c_str(), STGM_READ))) { |
| 789 DLOG(WARNING) << "Failed loading shortcut at " << shortcut.value(); | 790 DLOG(WARNING) << "Failed loading shortcut at " << shortcut.value(); |
| 790 continue; | 791 continue; |
| 791 } | 792 } |
| 792 | 793 |
| 793 // Any properties that need to be updated on the shortcut will be stored in | 794 // Any properties that need to be updated on the shortcut will be stored in |
| 794 // |updated_properties|. | 795 // |updated_properties|. |
| 795 base::win::ShortcutProperties updated_properties; | 796 base::win::ShortcutProperties updated_properties; |
| 796 | 797 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 base::win::SHORTCUT_UPDATE_EXISTING)) { | 850 base::win::SHORTCUT_UPDATE_EXISTING)) { |
| 850 ++shortcuts_migrated; | 851 ++shortcuts_migrated; |
| 851 } | 852 } |
| 852 } | 853 } |
| 853 return shortcuts_migrated; | 854 return shortcuts_migrated; |
| 854 } | 855 } |
| 855 | 856 |
| 856 } // namespace win | 857 } // namespace win |
| 857 | 858 |
| 858 } // namespace shell_integration | 859 } // namespace shell_integration |
| OLD | NEW |