diff options
Diffstat (limited to 'chromium/base/win/shortcut.cc')
-rw-r--r-- | chromium/base/win/shortcut.cc | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/chromium/base/win/shortcut.cc b/chromium/base/win/shortcut.cc index eef299b9440..f8b2182b286 100644 --- a/chromium/base/win/shortcut.cc +++ b/chromium/base/win/shortcut.cc @@ -33,7 +33,7 @@ void InitializeShortcutInterfaces( i_persist_file->Release(); if (FAILED(i_shell_link->CreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER)) || - FAILED(i_persist_file->QueryFrom(*i_shell_link)) || + FAILED(i_persist_file->QueryFrom(i_shell_link->get())) || (shortcut && FAILED((*i_persist_file)->Load(shortcut, STGM_READWRITE)))) { i_shell_link->Release(); i_persist_file->Release(); @@ -42,6 +42,13 @@ void InitializeShortcutInterfaces( } // namespace +ShortcutProperties::ShortcutProperties() + : icon_index(-1), dual_mode(false), options(0U) { +} + +ShortcutProperties::~ShortcutProperties() { +} + bool CreateOrUpdateShortcutLink(const FilePath& shortcut_path, const ShortcutProperties& properties, ShortcutOperation operation) { @@ -129,15 +136,17 @@ bool CreateOrUpdateShortcutLink(const FilePath& shortcut_path, if ((has_app_id || has_dual_mode) && GetVersion() >= VERSION_WIN7) { ScopedComPtr<IPropertyStore> property_store; - if (FAILED(property_store.QueryFrom(i_shell_link)) || !property_store.get()) + if (FAILED(property_store.QueryFrom(i_shell_link.get())) || + !property_store.get()) return false; if (has_app_id && - !SetAppIdForPropertyStore(property_store, properties.app_id.c_str())) { + !SetAppIdForPropertyStore(property_store.get(), + properties.app_id.c_str())) { return false; } if (has_dual_mode && - !SetBooleanValueForPropertyStore(property_store, + !SetBooleanValueForPropertyStore(property_store.get(), PKEY_AppUserModel_IsDualMode, properties.dual_mode)) { return false; @@ -192,7 +201,7 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path, ScopedComPtr<IPersistFile> persist; // Query IShellLink for the IPersistFile interface. - if (FAILED(persist.QueryFrom(i_shell_link))) + if (FAILED(persist.QueryFrom(i_shell_link.get()))) return false; // Load the shell link. @@ -239,7 +248,7 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path, if ((options & ShortcutProperties::PROPERTIES_WIN7) && GetVersion() >= VERSION_WIN7) { ScopedComPtr<IPropertyStore> property_store; - if (FAILED(property_store.QueryFrom(i_shell_link))) + if (FAILED(property_store.QueryFrom(i_shell_link.get()))) return false; if (options & ShortcutProperties::PROPERTIES_APP_ID) { @@ -312,8 +321,8 @@ bool TaskbarPinShortcutLink(const wchar_t* shortcut) { if (GetVersion() < VERSION_WIN7) return false; - int result = reinterpret_cast<int>(ShellExecute(NULL, L"taskbarpin", shortcut, - NULL, NULL, 0)); + intptr_t result = reinterpret_cast<intptr_t>( + ShellExecute(NULL, L"taskbarpin", shortcut, NULL, NULL, 0)); return result > 32; } @@ -324,8 +333,8 @@ bool TaskbarUnpinShortcutLink(const wchar_t* shortcut) { if (GetVersion() < VERSION_WIN7) return false; - int result = reinterpret_cast<int>(ShellExecute(NULL, L"taskbarunpin", - shortcut, NULL, NULL, 0)); + intptr_t result = reinterpret_cast<intptr_t>( + ShellExecute(NULL, L"taskbarunpin", shortcut, NULL, NULL, 0)); return result > 32; } |