Merge pull request #3890 from jaanus/hidden-inset-fullscreen-fix

Fixes #2810: correct look of hidden-inset windows in full screen.
This commit is contained in:
Cheng Zhao 2015-12-23 11:26:06 +08:00
Родитель a1936ecf82 aa2f7aaf3a
Коммит 79b507bda6
2 изменённых файлов: 30 добавлений и 0 удалений

Просмотреть файл

@ -78,6 +78,10 @@ class NativeWindowMac : public NativeWindow {
UpdateDraggableRegionViews(draggable_regions_);
}
bool ShouldHideNativeToolbarInFullscreen() const {
return should_hide_native_toolbar_in_fullscreen_;
}
protected:
// NativeWindow:
void HandleKeyboardEvent(
@ -118,6 +122,8 @@ class NativeWindowMac : public NativeWindow {
// The presentation options before entering kiosk mode.
NSApplicationPresentationOptions kiosk_options_;
bool should_hide_native_toolbar_in_fullscreen_;
DISALLOW_COPY_AND_ASSIGN(NativeWindowMac);
};

Просмотреть файл

@ -177,10 +177,25 @@ bool ScopedDisableResize::disable_resize_ = false;
}
- (void)windowDidEnterFullScreen:(NSNotification*)notification {
if (shell_->ShouldHideNativeToolbarInFullscreen()) {
NSWindow* window = shell_->GetNativeWindow();
[window setToolbar:nil];
}
shell_->NotifyWindowEnterFullScreen();
}
- (void)windowDidExitFullScreen:(NSNotification*)notification {
// Restore the native toolbar for styling if needed
if (shell_->ShouldHideNativeToolbarInFullscreen()) {
NSWindow* window = shell_->GetNativeWindow();
base::scoped_nsobject<NSToolbar> toolbar(
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
[toolbar setShowsBaselineSeparator:NO];
[window setToolbar:toolbar];
}
if (!shell_->has_frame()) {
NSWindow* window = shell_->GetNativeWindow();
[[window standardWindowButton:NSWindowFullScreenButton] setHidden:YES];
@ -378,6 +393,15 @@ NativeWindowMac::NativeWindowMac(
styleMask |= NSUnifiedTitleAndToolbarWindowMask;
}
// We capture this because we need to access the option later when entering/exiting fullscreen
// and since the options dict is only passed to the constructor but not stored,
// lets store this option this way.
if (titleBarStyle == "hidden-inset") {
should_hide_native_toolbar_in_fullscreen_ = true;
} else {
should_hide_native_toolbar_in_fullscreen_ = false;
}
window_.reset([[AtomNSWindow alloc]
initWithContentRect:cocoa_bounds
styleMask:styleMask