feat: migrate custom macOS tray view to native one (#18981)

* restore stash

revert

some things work others dont

tracking area for rescue

manual popup

restore drag n drop

cleanup

* fix: make tray not block main process (#18880)

* fix: make tray not block main process

* make AtomMenuModel refcounted

* add support for ansi codes in title

add remove TODOs

* chore: use ScopedPumpMessagesInPrivateModes in tray (#18977)

* chore: use ScopedPumpMessagesInPrivateModes in tray

* revert refcounting of AtomMenuModel

* Prefer WeakPtr for posting tasks to handle unexpected destruction

* cleanup .h

* cleanup .mm

* add imports

add missing include

* fix: crash when tray popup called twice (#18999)

* remove highlightMode and TODOs

* remove unnecessary copy
This commit is contained in:
Micha Hanselmann 2019-07-31 10:52:50 -07:00 committed by Samuel Attard
parent cde79501e3
commit 47a38daee2
8 changed files with 51 additions and 358 deletions

View file

@ -18,34 +18,6 @@
#include "shell/common/node_includes.h"
#include "ui/gfx/image/image.h"
namespace mate {
template <>
struct Converter<electron::TrayIcon::HighlightMode> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
electron::TrayIcon::HighlightMode* out) {
using HighlightMode = electron::TrayIcon::HighlightMode;
std::string mode;
if (ConvertFromV8(isolate, val, &mode)) {
if (mode == "always") {
*out = HighlightMode::ALWAYS;
return true;
}
if (mode == "selection") {
*out = HighlightMode::SELECTION;
return true;
}
if (mode == "never") {
*out = HighlightMode::NEVER;
return true;
}
}
return false;
}
};
} // namespace mate
namespace electron {
namespace api {
@ -169,10 +141,6 @@ std::string Tray::GetTitle() {
#endif
}
void Tray::SetHighlightMode(TrayIcon::HighlightMode mode) {
tray_icon_->SetHighlightMode(mode);
}
void Tray::SetIgnoreDoubleClickEvents(bool ignore) {
#if defined(OS_MACOSX)
tray_icon_->SetIgnoreDoubleClickEvents(ignore);
@ -235,7 +203,6 @@ void Tray::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setToolTip", &Tray::SetToolTip)
.SetMethod("setTitle", &Tray::SetTitle)
.SetMethod("getTitle", &Tray::GetTitle)
.SetMethod("setHighlightMode", &Tray::SetHighlightMode)
.SetMethod("setIgnoreDoubleClickEvents",
&Tray::SetIgnoreDoubleClickEvents)
.SetMethod("getIgnoreDoubleClickEvents",

View file

@ -70,7 +70,6 @@ class Tray : public mate::TrackableObject<Tray>, public TrayIconObserver {
void SetToolTip(const std::string& tool_tip);
void SetTitle(const std::string& title);
std::string GetTitle();
void SetHighlightMode(TrayIcon::HighlightMode mode);
void SetIgnoreDoubleClickEvents(bool ignore);
bool GetIgnoreDoubleClickEvents();
void DisplayBalloon(mate::Arguments* args, const mate::Dictionary& options);