Remove Menu::Popup

This commit is contained in:
Cheng Zhao 2016-01-22 11:59:08 -07:00
parent d1051b55cc
commit 984462be44
3 changed files with 10 additions and 13 deletions

View file

@ -69,10 +69,6 @@ void Menu::MenuWillShow(ui::SimpleMenuModel* source) {
menu_will_show_.Run();
}
void Menu::Popup(Window* window) {
PopupAt(window);
}
void Menu::InsertItemAt(
int index, int command_id, const base::string16& label) {
model_->InsertItemAt(index, command_id, label);
@ -173,8 +169,7 @@ void Menu::BuildPrototype(v8::Isolate* isolate,
.SetMethod("isItemCheckedAt", &Menu::IsItemCheckedAt)
.SetMethod("isEnabledAt", &Menu::IsEnabledAt)
.SetMethod("isVisibleAt", &Menu::IsVisibleAt)
.SetMethod("_popup", &Menu::Popup)
.SetMethod("_popupAt", &Menu::PopupAt);
.SetMethod("popupAt", &Menu::PopupAt);
}
} // namespace api

View file

@ -51,7 +51,6 @@ class Menu : public mate::TrackableObject<Menu>,
void ExecuteCommand(int command_id, int event_flags) override;
void MenuWillShow(ui::SimpleMenuModel* source) override;
void Popup(Window* window);
virtual void PopupAt(Window* window,
int x = -1, int y = -1,
int positioning_item = 0) = 0;

View file

@ -159,17 +159,20 @@ Menu.prototype._init = function() {
};
Menu.prototype.popup = function(window, x, y, positioningItem) {
if ((window != null ? window.constructor : void 0) !== BrowserWindow) {
if (typeof window != 'object' || window.constructor !== BrowserWindow) {
// Shift.
positioningItem = y;
y = x;
x = window;
window = BrowserWindow.getFocusedWindow();
}
if ((x != null) && (y != null)) {
return this._popupAt(window, x, y, positioningItem || 0);
} else {
return this._popup(window);
}
// Default parameters.
if (typeof x !== 'number') x = -1;
if (typeof y !== 'number') y = -1;
if (typeof positioningItem !== 'number') positioningItem = 0;
this.popupAt(window, x, y, positioningItem);
};
Menu.prototype.append = function(item) {