Browse Source

Fix implicit appUserModelId set

Samuel Attard 7 years ago
parent
commit
72464a6db5
2 changed files with 10 additions and 9 deletions
  1. 9 2
      atom/browser/browser_win.cc
  2. 1 7
      brightray/browser/win/windows_toast_notification.cc

+ 9 - 2
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(&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();

+ 1 - 7
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(&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();
 }