const mate::Dictionary& options)
: content::WebContentsObserver(inspectable_web_contents->GetWebContents()),
has_frame_(true),
- force_using_draggable_region_(false),
transparent_(false),
enable_larger_than_screen_(false),
is_closed_(false),
void NativeWindow::UpdateDraggableRegions(
const std::vector<DraggableRegion>& regions) {
// Draggable region is not supported for non-frameless window.
- if (has_frame_ && !force_using_draggable_region_)
+ if (has_frame_)
return;
draggable_region_ = DraggableRegionsToSkRegion(regions);
}
}
bool has_frame() const { return has_frame_; }
+ void set_has_frame(bool has_frame) { has_frame_ = has_frame; }
+
bool transparent() const { return transparent_; }
SkRegion* draggable_region() const { return draggable_region_.get(); }
bool enable_larger_than_screen() const { return enable_larger_than_screen_; }
gfx::ImageSkia icon() const { return icon_; }
- bool force_using_draggable_region() const {
- return force_using_draggable_region_;
- }
- void set_force_using_draggable_region(bool force) {
- force_using_draggable_region_ = true;
- }
-
void set_has_dialog_attached(bool has_dialog_attached) {
has_dialog_attached_ = has_dialog_attached;
}
// Whether window has standard frame.
bool has_frame_;
- // Force the window to be aware of draggable regions.
- bool force_using_draggable_region_;
-
// Whether window is transparent.
bool transparent_;
: NativeWindow(web_contents, options),
is_kiosk_(false),
attention_request_id_(0),
+ force_show_buttons_(false),
should_hide_native_toolbar_in_fullscreen_(false) {
int width = 800, height = 600;
options.Get(options::kWidth, &width);
if (closable) {
styleMask |= NSClosableWindowMask;
}
+ if ((titleBarStyle == "hidden") || (titleBarStyle == "hidden-inset")) {
+ // The window without titlebar is treated the same with frameless window.
+ set_has_frame(false);
+ force_show_buttons_ = true;
+ }
if (!useStandardWindow || transparent() || !has_frame()) {
styleMask |= NSTexturedBackgroundWindowMask;
}
if (resizable) {
styleMask |= NSResizableWindowMask;
}
- if ((titleBarStyle == "hidden") || (titleBarStyle == "hidden-inset")) {
- styleMask |= NSFullSizeContentViewWindowMask;
- 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, let’s store this option this way.
- if (titleBarStyle == "hidden-inset") {
- should_hide_native_toolbar_in_fullscreen_ = true;
- }
window_.reset([[AtomNSWindow alloc]
initWithContentRect:cocoa_bounds
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
[toolbar setShowsBaselineSeparator:NO];
[window_ setToolbar:toolbar];
+ should_hide_native_toolbar_in_fullscreen_ = true;
}
- // We should be aware of draggable regions when using hidden titlebar.
- set_force_using_draggable_region(true);
}
// On OS X the initial window size doesn't include window frame.
[view setFrame:[content_view_ bounds]];
[content_view_ addSubview:view];
+ if (force_show_buttons_)
+ return;
+
+ // Hide the window buttons.
[[window_ standardWindowButton:NSWindowZoomButton] setHidden:YES];
[[window_ standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
[[window_ standardWindowButton:NSWindowCloseButton] setHidden:YES];
void NativeWindowMac::UpdateDraggableRegionViews(
const std::vector<DraggableRegion>& regions) {
- if (has_frame() && !force_using_draggable_region())
+ if (has_frame())
return;
// All ControlRegionViews should be added as children of the WebContentsView,