Enable native tabs on macOS
This commit is contained in:
parent
9e02c60e22
commit
a7565f0d57
5 changed files with 23 additions and 1 deletions
|
@ -179,6 +179,8 @@ class NativeWindowMac : public NativeWindow,
|
||||||
// The "titleBarStyle" option.
|
// The "titleBarStyle" option.
|
||||||
TitleBarStyle title_bar_style_;
|
TitleBarStyle title_bar_style_;
|
||||||
|
|
||||||
|
std::string tabbing_identifier_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(NativeWindowMac);
|
DISALLOW_COPY_AND_ASSIGN(NativeWindowMac);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -656,7 +656,8 @@ NativeWindowMac::NativeWindowMac(
|
||||||
was_fullscreen_(false),
|
was_fullscreen_(false),
|
||||||
zoom_to_page_width_(false),
|
zoom_to_page_width_(false),
|
||||||
attention_request_id_(0),
|
attention_request_id_(0),
|
||||||
title_bar_style_(NORMAL) {
|
title_bar_style_(NORMAL),
|
||||||
|
tabbing_identifier_(""){
|
||||||
int width = 800, height = 600;
|
int width = 800, height = 600;
|
||||||
options.Get(options::kWidth, &width);
|
options.Get(options::kWidth, &width);
|
||||||
options.Get(options::kHeight, &height);
|
options.Get(options::kHeight, &height);
|
||||||
|
@ -682,6 +683,8 @@ NativeWindowMac::NativeWindowMac(
|
||||||
|
|
||||||
options.Get(options::kTitleBarStyle, &title_bar_style_);
|
options.Get(options::kTitleBarStyle, &title_bar_style_);
|
||||||
|
|
||||||
|
options.Get(options::kTabbingIdentifier, &tabbing_identifier_);
|
||||||
|
|
||||||
std::string windowType;
|
std::string windowType;
|
||||||
options.Get(options::kType, &windowType);
|
options.Get(options::kType, &windowType);
|
||||||
|
|
||||||
|
@ -754,6 +757,16 @@ NativeWindowMac::NativeWindowMac(
|
||||||
[window_ setOpaque:NO];
|
[window_ setOpaque:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (base::mac::IsAtLeastOS10_12()) {
|
||||||
|
// Create a tab only if tabbing identifier is specified and window has
|
||||||
|
// a native title bar.
|
||||||
|
if (tabbing_identifier_.empty() || transparent() || !has_frame()) {
|
||||||
|
[window_ setTabbingMode:NSWindowTabbingModeDisallowed];
|
||||||
|
} else {
|
||||||
|
[window_ setTabbingIdentifier:base::SysUTF8ToNSString(tabbing_identifier_)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// We will manage window's lifetime ourselves.
|
// We will manage window's lifetime ourselves.
|
||||||
[window_ setReleasedWhenClosed:NO];
|
[window_ setReleasedWhenClosed:NO];
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,9 @@ const char kZoomToPageWidth[] = "zoomToPageWidth";
|
||||||
// The requested title bar style for the window
|
// The requested title bar style for the window
|
||||||
const char kTitleBarStyle[] = "titleBarStyle";
|
const char kTitleBarStyle[] = "titleBarStyle";
|
||||||
|
|
||||||
|
// Tabbing identifier for the window if native tabs are enabled on macOS.
|
||||||
|
const char kTabbingIdentifier[] = "tabbingIdentifier";
|
||||||
|
|
||||||
// The menu bar is hidden unless "Alt" is pressed.
|
// The menu bar is hidden unless "Alt" is pressed.
|
||||||
const char kAutoHideMenuBar[] = "autoHideMenuBar";
|
const char kAutoHideMenuBar[] = "autoHideMenuBar";
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ extern const char kAcceptFirstMouse[];
|
||||||
extern const char kUseContentSize[];
|
extern const char kUseContentSize[];
|
||||||
extern const char kZoomToPageWidth[];
|
extern const char kZoomToPageWidth[];
|
||||||
extern const char kTitleBarStyle[];
|
extern const char kTitleBarStyle[];
|
||||||
|
extern const char kTabbingIdentifier[];
|
||||||
extern const char kAutoHideMenuBar[];
|
extern const char kAutoHideMenuBar[];
|
||||||
extern const char kEnableLargerThanScreen[];
|
extern const char kEnableLargerThanScreen[];
|
||||||
extern const char kDarkTheme[];
|
extern const char kDarkTheme[];
|
||||||
|
|
|
@ -264,6 +264,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||||
canvas features. Default is `false`.
|
canvas features. Default is `false`.
|
||||||
* `scrollBounce` Boolean (optional) - Enables scroll bounce (rubber banding) effect on
|
* `scrollBounce` Boolean (optional) - Enables scroll bounce (rubber banding) effect on
|
||||||
macOS. Default is `false`.
|
macOS. Default is `false`.
|
||||||
|
* `tabbingIdentifier` String (optional) - Tab group name, allows opening the
|
||||||
|
window as a native tab on macOS 10.12+. Windows with the same tabbing identifier will
|
||||||
|
be grouped together.
|
||||||
* `blinkFeatures` String (optional) - A list of feature strings separated by `,`, like
|
* `blinkFeatures` String (optional) - A list of feature strings separated by `,`, like
|
||||||
`CSSVariables,KeyboardEventKey` to enable. The full list of supported feature
|
`CSSVariables,KeyboardEventKey` to enable. The full list of supported feature
|
||||||
strings can be found in the [RuntimeEnabledFeatures.json5][blink-feature-string]
|
strings can be found in the [RuntimeEnabledFeatures.json5][blink-feature-string]
|
||||||
|
|
Loading…
Reference in a new issue