[Win] Implement context menu.
authorCheng Zhao <zcbenz@gmail.com>
Tue, 6 Aug 2013 13:08:52 +0000 (21:08 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 6 Aug 2013 13:08:52 +0000 (21:08 +0800)
browser/api/atom_api_menu_win.cc
browser/api/atom_api_menu_win.h

index 8023fb1..d5690d5 100644 (file)
@@ -4,6 +4,9 @@
 
 #include "browser/api/atom_api_menu_win.h"
 
+#include "ui/views/controls/menu/menu_2.h"
+#include "ui/gfx/point.h"
+
 namespace atom {
 
 namespace api {
@@ -16,6 +19,8 @@ MenuWin::~MenuWin() {
 }
 
 void MenuWin::Popup(NativeWindow* native_window) {
+  menu_.reset(new views::Menu2(model_.get()));
+  menu_->RunContextMenuAt(gfx::Point(0, 0));
 }
 
 // static
index d0f2559..380b6b6 100644 (file)
@@ -7,6 +7,10 @@
 
 #include "browser/api/atom_api_menu.h"
 
+namespace views {
+class Menu2;
+}
+
 namespace atom {
 
 namespace api {
@@ -20,6 +24,8 @@ class MenuWin : public Menu {
   virtual void Popup(NativeWindow* window) OVERRIDE;
 
  private:
+  scoped_ptr<views::Menu2> menu_;
+
   DISALLOW_COPY_AND_ASSIGN(MenuWin);
 };