feat: make trafficLightPosition work for customButtonOnHover (#26789)

This commit is contained in:
Cheng Zhao 2020-12-16 14:30:39 +09:00 committed by GitHub
parent 1e2a2004e9
commit e01b1831d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 76 additions and 45 deletions

View file

@ -842,11 +842,16 @@ void BaseWindow::SetVibrancy(v8::Isolate* isolate, v8::Local<v8::Value> value) {
#if defined(OS_MAC)
void BaseWindow::SetTrafficLightPosition(const gfx::Point& position) {
window_->SetTrafficLightPosition(position);
// For backward compatibility we treat (0, 0) as reseting to default.
if (position.IsOrigin())
window_->SetTrafficLightPosition(base::nullopt);
else
window_->SetTrafficLightPosition(position);
}
gfx::Point BaseWindow::GetTrafficLightPosition() const {
return window_->GetTrafficLightPosition();
// For backward compatibility we treat default value as (0, 0).
return window_->GetTrafficLightPosition().value_or(gfx::Point());
}
#endif