Fix implicit appUserModelId set

This commit is contained in:
Samuel Attard 2017-12-05 11:01:02 -06:00 committed by Cheng Zhao
parent ab015e573b
commit 72464a6db5
2 changed files with 10 additions and 9 deletions

View file

@ -325,8 +325,15 @@ Browser::LoginItemSettings Browser::GetLoginItemSettings(
PCWSTR Browser::GetAppUserModelID() {
if (app_user_model_id_.empty()) {
SetAppUserModelID(base::ReplaceStringPlaceholders(
kAppUserModelIDFormat, base::UTF8ToUTF16(GetName()), nullptr));
PWSTR current_app_id;
if (SUCCEEDED(GetCurrentProcessExplicitAppUserModelID(&current_app_id))) {
app_user_model_id_ = currrent_app_id;
} else {
current_app_id = base::ReplaceStringPlaceholders(
kAppUserModelIDFormat, base::UTF8ToUTF16(GetName()), nullptr);
SetAppUserModelID(current_app_id);
}
CoTaskMemFree(current_app_id);
}
return app_user_model_id_.c_str();

View file

@ -32,13 +32,7 @@ namespace brightray {
namespace {
bool GetAppUserModelId(ScopedHString* app_id) {
PWSTR current_app_id;
if (SUCCEEDED(GetCurrentProcessExplicitAppUserModelID(&current_app_id))) {
app_id->Reset(current_app_id);
CoTaskMemFree(current_app_id);
} else {
app_id->Reset(base::UTF8ToUTF16(GetApplicationName()));
}
app_id->Reset(atom::api::Browser::Get()->GetAppUserModelID());
return app_id->success();
}