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

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

Issue 26427002: Add always-on-top property to app windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 7 years, 2 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 5023194f69e6bef61035757bee43c1f89f74653a..fd18e0ce06d7c37e9b9359641c466d0f4382a78d 100644
--- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
@@ -265,6 +265,12 @@ void SetFullScreenCollectionBehavior(NSWindow* window, bool allow_fullscreen) {
- (void)setMouseDownCanMoveWindow:(BOOL)can_move;
@end
+namespace {
+
+const NSInteger kAlwaysOnTopWindowLevel = NSFloatingWindowLevel;
+
+} // namespace
+
NativeAppWindowCocoa::NativeAppWindowCocoa(
ShellWindow* shell_window,
const ShellWindow::CreateParams& params)
@@ -334,6 +340,9 @@ NativeAppWindowCocoa::NativeAppWindowCocoa(
[window respondsToSelector:@selector(setBottomCornerRounded:)])
[window setBottomCornerRounded:NO];
+ if (params.always_on_top)
+ [window setLevel:kAlwaysOnTopWindowLevel];
+
// Set the window to participate in Lion Fullscreen mode. Setting this flag
// has no effect on Snow Leopard or earlier. UI controls for fullscreen are
// only shown for apps that have unbounded size.
@@ -810,7 +819,7 @@ void NativeAppWindowCocoa::FlashFrame(bool flash) {
}
bool NativeAppWindowCocoa::IsAlwaysOnTop() const {
- return false;
+ return [window() level] == kAlwaysOnTopWindowLevel;
}
void NativeAppWindowCocoa::RenderViewHostChanged(
@@ -986,6 +995,12 @@ void NativeAppWindowCocoa::ShowWithApp() {
shell_window_->OnNativeWindowChanged();
}
+void NativeAppWindowCocoa::SetAlwaysOnTop(bool always_on_top) {
+ [window() setLevel:(always_on_top ? kAlwaysOnTopWindowLevel :
+ NSNormalWindowLevel)];
+ shell_window_->OnNativeWindowChanged();
+}
+
void NativeAppWindowCocoa::HideWithoutMarkingHidden() {
[window() orderOut:window_controller_];
}
« no previous file with comments | « chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h ('k') | chrome/browser/ui/cocoa/browser_window_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698