| Index: ui/gfx/mac/nswindow_frame_controls.mm
|
| diff --git a/ui/gfx/mac/nswindow_frame_controls.mm b/ui/gfx/mac/nswindow_frame_controls.mm
|
| index 34f7d266516c823bc53ea6f612eee9dc22446057..e1983daa2d25a9c0b7d6def9bcdf6a00b7d32cc3 100644
|
| --- a/ui/gfx/mac/nswindow_frame_controls.mm
|
| +++ b/ui/gfx/mac/nswindow_frame_controls.mm
|
| @@ -22,6 +22,13 @@ void SetResizableStyleMask(NSWindow* window, bool resizable) {
|
| [window setStyleMask:style_mask];
|
| }
|
|
|
| +// Returns the level for windows that are configured to be always on top.
|
| +// This is not a constant because NSFloatingWindowLevel is a macro defined
|
| +// as a function call.
|
| +NSInteger AlwaysOnTopWindowLevel() {
|
| + return NSFloatingWindowLevel;
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace gfx {
|
| @@ -35,6 +42,32 @@ void SetNSWindowCanFullscreen(NSWindow* window, bool allow_fullscreen) {
|
| [window setCollectionBehavior:behavior];
|
| }
|
|
|
| +bool IsNSWindowAlwaysOnTop(NSWindow* window) {
|
| + return [window level] == AlwaysOnTopWindowLevel();
|
| +}
|
| +
|
| +void SetNSWindowAlwaysOnTop(NSWindow* window,
|
| + bool always_on_top) {
|
| + [window setLevel:(always_on_top ? AlwaysOnTopWindowLevel()
|
| + : NSNormalWindowLevel)];
|
| + // Since always-on-top windows have a higher window level than
|
| + // NSNormalWindowLevel, they will default to
|
| + // NSWindowCollectionBehaviorTransient. Set the value explicitly here to match
|
| + // normal windows.
|
| + NSWindowCollectionBehavior behavior =
|
| + [window collectionBehavior] | NSWindowCollectionBehaviorManaged;
|
| + [window setCollectionBehavior:behavior];
|
| +}
|
| +
|
| +void SetNSWindowVisibleOnAllWorkspaces(NSWindow* window, bool always_visible) {
|
| + NSWindowCollectionBehavior behavior = [window collectionBehavior];
|
| + if (always_visible)
|
| + behavior |= NSWindowCollectionBehaviorCanJoinAllSpaces;
|
| + else
|
| + behavior &= ~NSWindowCollectionBehaviorCanJoinAllSpaces;
|
| + [window setCollectionBehavior:behavior];
|
| +}
|
| +
|
| void ApplyNSWindowSizeConstraints(NSWindow* window,
|
| const gfx::Size& min_size,
|
| const gfx::Size& max_size,
|
|
|