Remove the JavaScript wrapper for setContextMenu
This commit is contained in:
parent
adfd99f5f0
commit
67d9ae27c3
3 changed files with 5 additions and 10 deletions
|
@ -142,7 +142,8 @@ void Tray::PopUpContextMenu(mate::Arguments* args) {
|
|||
tray_icon_->PopUpContextMenu(pos, menu.IsEmpty() ? nullptr : menu->model());
|
||||
}
|
||||
|
||||
void Tray::SetContextMenu(Menu* menu) {
|
||||
void Tray::SetContextMenu(v8::Isolate* isolate, mate::Handle<Menu> menu) {
|
||||
menu_.Reset(isolate, menu.ToV8());
|
||||
tray_icon_->SetContextMenu(menu->model());
|
||||
}
|
||||
|
||||
|
@ -168,7 +169,7 @@ void Tray::BuildPrototype(v8::Isolate* isolate,
|
|||
.SetMethod("setHighlightMode", &Tray::SetHighlightMode)
|
||||
.SetMethod("displayBalloon", &Tray::DisplayBalloon)
|
||||
.SetMethod("popUpContextMenu", &Tray::PopUpContextMenu)
|
||||
.SetMethod("_setContextMenu", &Tray::SetContextMenu);
|
||||
.SetMethod("setContextMenu", &Tray::SetContextMenu);
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
|
|
@ -64,13 +64,14 @@ class Tray : public mate::TrackableObject<Tray>,
|
|||
void SetHighlightMode(bool highlight);
|
||||
void DisplayBalloon(mate::Arguments* args, const mate::Dictionary& options);
|
||||
void PopUpContextMenu(mate::Arguments* args);
|
||||
void SetContextMenu(Menu* menu);
|
||||
void SetContextMenu(v8::Isolate* isolate, mate::Handle<Menu> menu);
|
||||
|
||||
private:
|
||||
v8::Local<v8::Object> ModifiersToObject(v8::Isolate* isolate, int modifiers);
|
||||
|
||||
v8::Global<v8::Object> image_;
|
||||
v8::Global<v8::Object> pressed_image_;
|
||||
v8::Global<v8::Object> menu_;
|
||||
scoped_ptr<TrayIcon> tray_icon_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Tray);
|
||||
|
|
|
@ -3,11 +3,4 @@ const {Tray} = process.atomBinding('tray')
|
|||
|
||||
Object.setPrototypeOf(Tray.prototype, EventEmitter.prototype)
|
||||
|
||||
Tray.prototype.setContextMenu = function (menu) {
|
||||
this._setContextMenu(menu)
|
||||
|
||||
// Keep a strong reference of menu.
|
||||
this.menu = menu
|
||||
}
|
||||
|
||||
module.exports = Tray
|
||||
|
|
Loading…
Reference in a new issue