From 72464a6db552a3d87387778262c67cfe00c28727 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 5 Dec 2017 11:01:02 -0600 Subject: [PATCH] Fix implicit appUserModelId set --- atom/browser/browser_win.cc | 11 +++++++++-- brightray/browser/win/windows_toast_notification.cc | 8 +------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/atom/browser/browser_win.cc b/atom/browser/browser_win.cc index 1a0c3430ffc9..f1ab2b98b941 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 78a8f6fc0e79..880b1dc312fb 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(); }