Fix desktop-id notification edge case (#12216)
* Fix desktop-id notification edge case * Extract-method platform_util::GetDesktopName() This removes duplicated code from libnotify_notifications.cc and atom/common/linux/application_info.cc. * Check for empty case in GetDesktopName(). * Move GetDesktopName() to brightray::util * Remove unnecessary changes in platform_util * Add a brightray::platform_util namespace
This commit is contained in:
parent
86af20ded0
commit
dd2c2660b9
5 changed files with 62 additions and 8 deletions
|
@ -8,13 +8,13 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/environment.h"
|
||||
#include "base/files/file_enumerator.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "brightray/browser/notification_delegate.h"
|
||||
#include "brightray/common/application_info.h"
|
||||
#include "brightray/common/platform_util.h"
|
||||
#include "chrome/browser/ui/libgtkui/gtk_util.h"
|
||||
#include "chrome/browser/ui/libgtkui/skia_utils_gtk.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
|
@ -130,9 +130,8 @@ void LibnotifyNotification::Show(const NotificationOptions& options) {
|
|||
|
||||
// Send the desktop name to identify the application
|
||||
// The desktop-entry is the part before the .desktop
|
||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||
std::string desktop_id = libgtkui::GetDesktopName(env.get());
|
||||
if (!desktop_id.empty()) {
|
||||
std::string desktop_id;
|
||||
if (platform_util::GetDesktopName(&desktop_id)) {
|
||||
const std::string suffix{".desktop"};
|
||||
if (base::EndsWith(desktop_id, suffix,
|
||||
base::CompareCase::INSENSITIVE_ASCII)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue