]> khamidou — GitHub mirrors - electron.git/commitdiff
Remove Menu::Popup
authorCheng Zhao <zcbenz@gmail.com>
Fri, 22 Jan 2016 18:59:08 +0000 (11:59 -0700)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 22 Jan 2016 18:59:08 +0000 (11:59 -0700)
atom/browser/api/atom_api_menu.cc
atom/browser/api/atom_api_menu.h
atom/browser/api/lib/menu.js

index ec56507390035d8025ea9bb83eb95a8988872bb7..e40ba17f464fe562f644d0cf2222c63281b5d48e 100644 (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
index 18cfae6a3481e7f29922cf85065027cc7e62a7bd..1ae708863a732c55d9a6fc56c70bcd691350a921 100644 (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;
index 506922fd4a808a87f519697681f40d5fb82b10cf..62c771af6c6d2aeb2d1f00ddb1d57ae3ca819f4e 100644 (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) {