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

Unified Diff: base/win_util.cc

Issue 399045: Set prop app id for chromium/application shortcut. (Closed)
Patch Set: more for hbono Created 11 years, 1 month 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
Index: base/win_util.cc
diff --git a/base/win_util.cc b/base/win_util.cc
index e66dc1c4e31f03ac0e0d9779eddb384b74609fba..6ff546f558685124147f3109c3a9a73ec0f211f8 100644
--- a/base/win_util.cc
+++ b/base/win_util.cc
@@ -4,6 +4,7 @@
#include "base/win_util.h"
+#include <propvarutil.h>
#include <sddl.h>
#include "base/logging.h"
@@ -384,6 +385,32 @@ base::KeyboardCode WinToKeyboardCode(WORD keycode) {
return static_cast<base::KeyboardCode>(keycode);
}
+bool SetAppIdForPropertyStore(IPropertyStore* property_store,
+ const wchar_t* app_id) {
+ DCHECK(property_store);
+
+ // App id should be less than 128 chars and contain no space. And recommended
+ // format is CompanyName.ProductName[.SubProduct.ProductNumber].
+ // See http://msdn.microsoft.com/en-us/library/dd378459%28VS.85%29.aspx
+ DCHECK(lstrlen(app_id) < 128 && wcschr(app_id, L' ') == NULL);
+
+ static const PROPERTYKEY PKEY_AppUserModel_ID =
Hironori Bono 2009/11/19 04:35:47 nit: the name of a const variable should use a k f
xiyuan 2009/11/19 07:30:18 Done.
+ { { 0x9F4C2855, 0x9F79, 0x4B39,
+ { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, } }, 5 };
+
+ PROPVARIANT property_value;
+ if (FAILED(InitPropVariantFromString(app_id, &property_value)))
+ return false;
+
+ HRESULT result = property_store->SetValue(PKEY_AppUserModel_ID,
+ property_value);
+ if (S_OK == result)
+ result = property_store->Commit();
+
+ PropVariantClear(&property_value);
+ return SUCCEEDED(result);
+}
+
} // namespace win_util
#ifdef _MSC_VER
« no previous file with comments | « base/win_util.h ('k') | chrome/browser/browser.h » ('j') | chrome/common/chrome_constants.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698