parent
3b183854ff
commit
2d3c65beca
31 changed files with 200 additions and 152 deletions
|
@ -15,6 +15,7 @@
|
|||
#include "base/file_version_info.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/string_util_win.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "shell/browser/win/scoped_hstring.h"
|
||||
|
@ -23,7 +24,7 @@ namespace electron {
|
|||
|
||||
namespace {
|
||||
|
||||
std::u16string g_app_user_model_id;
|
||||
std::wstring g_app_user_model_id;
|
||||
}
|
||||
|
||||
const wchar_t kAppUserModelIDFormat[] = L"electron.app.$1";
|
||||
|
@ -42,7 +43,7 @@ std::string GetApplicationVersion() {
|
|||
return base::UTF16ToUTF8(info->product_version());
|
||||
}
|
||||
|
||||
void SetAppUserModelID(const std::u16string& name) {
|
||||
void SetAppUserModelID(const std::wstring& name) {
|
||||
g_app_user_model_id = name;
|
||||
SetCurrentProcessExplicitAppUserModelID(g_app_user_model_id.c_str());
|
||||
}
|
||||
|
@ -54,8 +55,8 @@ PCWSTR GetRawAppUserModelID() {
|
|||
g_app_user_model_id = current_app_id;
|
||||
} else {
|
||||
std::string name = GetApplicationName();
|
||||
std::u16string generated_app_id = base::ReplaceStringPlaceholders(
|
||||
kAppUserModelIDFormat, base::UTF8ToUTF16(name), nullptr);
|
||||
std::wstring generated_app_id = base::ReplaceStringPlaceholders(
|
||||
kAppUserModelIDFormat, {base::UTF8ToWide(name)}, nullptr);
|
||||
SetAppUserModelID(generated_app_id);
|
||||
}
|
||||
CoTaskMemFree(current_app_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue