diff --git a/atom/browser/browser_win.cc b/atom/browser/browser_win.cc index 1a0c3430ff..f1ab2b98b9 100644 --- a/atom/browser/browser_win.cc +++ b/atom/browser/browser_win.cc @@ -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(¤t_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(); diff --git a/brightray/browser/win/windows_toast_notification.cc b/brightray/browser/win/windows_toast_notification.cc index 78a8f6fc0e..880b1dc312 100644 --- a/brightray/browser/win/windows_toast_notification.cc +++ b/brightray/browser/win/windows_toast_notification.cc @@ -32,13 +32,7 @@ namespace brightray { namespace { bool GetAppUserModelId(ScopedHString* app_id) { - PWSTR current_app_id; - if (SUCCEEDED(GetCurrentProcessExplicitAppUserModelID(¤t_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(); }