]> khamidou — GitHub mirrors - electron.git/commitdiff
Allow removing menu bar
authorCheng Zhao <zcbenz@gmail.com>
Thu, 4 Jun 2015 08:10:19 +0000 (16:10 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 4 Jun 2015 08:10:19 +0000 (16:10 +0800)
atom/browser/native_window_views.cc

index 8f5e51edafdcc1b65e84791a2373f06b954dbd22..710788ddbd11c024a909a12489e5d84ed970eb99 100644 (file)
@@ -541,6 +541,19 @@ bool NativeWindowViews::IsKiosk() {
 }
 
 void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) {
+  if (menu_model == nullptr) {
+    // Remove accelerators
+    accelerator_table_.clear();
+    GetFocusManager()->UnregisterAccelerators(this);
+    // and menu bar.
+#if defined(USE_X11)
+    global_menu_bar_.reset();
+#endif
+    SetMenuBarVisibility(false);
+    menu_bar_.reset();
+    return;
+  }
+
   RegisterAccelerators(menu_model);
 
 #if defined(USE_X11)