fix: make SetWindowButtonVisibility work for customButtonsOnHover (#27073)

This commit is contained in:
Cheng Zhao 2021-01-19 19:12:09 +09:00 committed by GitHub
parent 5e7e0a4c7e
commit c3091c3a70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 87 additions and 52 deletions

View file

@ -845,6 +845,14 @@ void BaseWindow::SetVibrancy(v8::Isolate* isolate, v8::Local<v8::Value> value) {
}
#if defined(OS_MAC)
void BaseWindow::SetWindowButtonVisibility(bool visible) {
window_->SetWindowButtonVisibility(visible);
}
bool BaseWindow::GetWindowButtonVisibility() const {
return window_->GetWindowButtonVisibility();
}
void BaseWindow::SetTrafficLightPosition(const gfx::Point& position) {
// For backward compatibility we treat (0, 0) as reseting to default.
if (position.IsOrigin())
@ -898,13 +906,6 @@ void BaseWindow::AddTabbedWindow(NativeWindow* window,
args->ThrowError("AddTabbedWindow cannot be called by a window on itself.");
}
void BaseWindow::SetWindowButtonVisibility(bool visible,
gin_helper::Arguments* args) {
if (!window_->SetWindowButtonVisibility(visible)) {
args->ThrowError("Not supported for this window");
}
}
void BaseWindow::SetAutoHideMenuBar(bool auto_hide) {
window_->SetAutoHideMenuBar(auto_hide);
}
@ -1243,6 +1244,8 @@ void BaseWindow::BuildPrototype(v8::Isolate* isolate,
.SetMethod("addTabbedWindow", &BaseWindow::AddTabbedWindow)
.SetMethod("setWindowButtonVisibility",
&BaseWindow::SetWindowButtonVisibility)
.SetMethod("_getWindowButtonVisibility",
&BaseWindow::GetWindowButtonVisibility)
.SetProperty("excludedFromShownWindowsMenu",
&BaseWindow::IsExcludedFromShownWindowsMenu,
&BaseWindow::SetExcludedFromShownWindowsMenu)