Index: chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm |
diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm |
index 691de9aaefe05eb44cedc4c42d5447bd8069d532..8bc1fd4268b964b1d3caaf1de2e4bf9e659d7a3f 100644 |
--- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm |
+++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm |
@@ -1,4 +1,4 @@ |
-// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Copyright 2013 The Chromium Authors. All rights rerved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -60,6 +60,15 @@ void SetFullScreenCollectionBehavior(NSWindow* window, bool allow_fullscreen) { |
[window setCollectionBehavior:behavior]; |
} |
+void SetWorkspacesCollectionBehavior(NSWindow* window, bool always_visible) { |
+ NSWindowCollectionBehavior behavior = [window collectionBehavior]; |
+ if (always_visible) |
+ behavior |= NSWindowCollectionBehaviorCanJoinAllSpaces; |
+ else |
+ behavior &= ~NSWindowCollectionBehaviorCanJoinAllSpaces; |
+ [window setCollectionBehavior:behavior]; |
+} |
+ |
void InitCollectionBehavior(NSWindow* window) { |
// Since always-on-top windows have a higher window level |
// than NSNormalWindowLevel, they will default to |
@@ -379,6 +388,8 @@ NativeAppWindowCocoa::NativeAppWindowCocoa( |
[window setLevel:AlwaysOnTopWindowLevel()]; |
InitCollectionBehavior(window); |
+ SetWorkspacesCollectionBehavior(window, params.visible_on_all_workspaces); |
+ |
window_controller_.reset( |
[[NativeAppWindowController alloc] initWithWindow:window.release()]); |
@@ -967,6 +978,10 @@ void NativeAppWindowCocoa::SetAlwaysOnTop(bool always_on_top) { |
NSNormalWindowLevel)]; |
} |
+void NativeAppWindowCocoa::SetVisibleOnAllWorkspaces(bool always_visible) { |
+ SetWorkspacesCollectionBehavior(window(), always_visible); |
+} |
+ |
NativeAppWindowCocoa::~NativeAppWindowCocoa() { |
} |