From cb8f97552822556f95e6e6b52ba88c17f63d6873 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 12 Nov 2014 20:31:55 +0800 Subject: [PATCH] Add JS menubar APIs --- atom/browser/api/atom_api_window.cc | 20 ++++++++++++++++++++ atom/browser/api/atom_api_window.h | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 1f4a4bbe6ce4..49ba2c8df7b2 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -378,6 +378,22 @@ void Window::SetProgressBar(double progress) { window_->SetProgressBar(progress); } +void Window::SetAutoHideMenuBar(bool auto_hide) { + window_->SetAutoHideMenuBar(auto_hide); +} + +bool Window::IsMenuBarAutoHide() { + return window_->IsMenuBarAutoHide(); +} + +void Window::SetMenuBarVisibility(bool visible) { + window_->SetMenuBarVisibility(visible); +} + +bool Window::IsMenuBarVisible() { + return window_->IsMenuBarVisible(); +} + mate::Handle Window::GetWebContents(v8::Isolate* isolate) const { return WebContents::CreateFrom(isolate, window_->GetWebContents()); } @@ -443,6 +459,10 @@ void Window::BuildPrototype(v8::Isolate* isolate, .SetMethod("capturePage", &Window::CapturePage) .SetMethod("print", &Window::Print) .SetMethod("setProgressBar", &Window::SetProgressBar) + .SetMethod("setAutoHideMenuBar", &Window::SetAutoHideMenuBar) + .SetMethod("isMenuBarAutoHide", &Window::IsMenuBarAutoHide) + .SetMethod("setMenuBarVisibility", &Window::SetMenuBarVisibility) + .SetMethod("isMenuBarVisible", &Window::IsMenuBarVisible) .SetMethod("_getWebContents", &Window::GetWebContents) .SetMethod("_getDevToolsWebContents", &Window::GetDevToolsWebContents); } diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index 905559a8c35f..370634f13105 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -111,6 +111,10 @@ class Window : public mate::EventEmitter, void CapturePage(mate::Arguments* args); void Print(mate::Arguments* args); void SetProgressBar(double progress); + void SetAutoHideMenuBar(bool auto_hide); + bool IsMenuBarAutoHide(); + void SetMenuBarVisibility(bool visible); + bool IsMenuBarVisible(); // APIs for WebContents. mate::Handle GetWebContents(v8::Isolate* isolate) const;