Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(755)

Unified Diff: chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm

Issue 469993003: Add AppWindow.setVisibleOnAllWorkspaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 72407678984f0e95927ca4bbe1128cb97c1ac7df..365a0154f9aaaeb8ff770407c2cf0a1f1f0a8b89 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
@@ -380,6 +389,8 @@ NativeAppWindowCocoa::NativeAppWindowCocoa(
[window setLevel:AlwaysOnTopWindowLevel()];
InitCollectionBehavior(window);
+ SetWorkspacesCollectionBehavior(window, params.visible_on_all_workspaces);
+
window_controller_.reset(
[[NativeAppWindowController alloc] initWithWindow:window.release()]);
@@ -974,6 +985,10 @@ void NativeAppWindowCocoa::SetAlwaysOnTop(bool always_on_top) {
NSNormalWindowLevel)];
}
+void NativeAppWindowCocoa::SetVisibleOnAllWorkspaces(bool always_visible) {
+ SetWorkspacesCollectionBehavior(window(), always_visible);
+}
+
NativeAppWindowCocoa::~NativeAppWindowCocoa() {
}

Powered by Google App Engine
This is Rietveld 408576698