Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3314)

Unified Diff: app/win_util.cc

Issue 160150: Add clean-up code to SetAppIdForWindow().... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/win_util.cc
===================================================================
--- app/win_util.cc (revision 21632)
+++ app/win_util.cc (working copy)
@@ -22,6 +22,7 @@
#include "base/logging.h"
#include "base/native_library.h"
#include "base/registry.h"
+#include "base/scoped_comptr_win.h"
#include "base/scoped_handle.h"
#include "base/string_util.h"
#include "base/win_util.h"
@@ -868,14 +869,17 @@
PROPVARIANT pv;
InitPropVariantFromString(app_id.c_str(), &pv);
- IPropertyStore* pps;
+ ScopedComPtr<IPropertyStore> pps;
SHGPSFW SHGetPropertyStoreForWindow = static_cast<SHGPSFW>(function);
- if (S_OK == SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pps)) &&
- S_OK == pps->SetValue(PKEY_AppUserModel_ID, pv)) {
- pps->Commit();
+ HRESULT result = SHGetPropertyStoreForWindow(
+ hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive()));
+ if (S_OK == result) {
+ if (S_OK == pps->SetValue(PKEY_AppUserModel_ID, pv))
+ pps->Commit();
}
// Cleanup.
+ PropVariantClear(&pv);
base::UnloadNativeLibrary(shell32_library);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698