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);
.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
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;
};
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) {