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_]; |
} |