OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 windowShim_->panel()->OnActiveStateChanged(false); | 842 windowShim_->panel()->OnActiveStateChanged(false); |
843 } | 843 } |
844 | 844 |
845 - (void)preventBecomingKeyWindow:(BOOL)prevent { | 845 - (void)preventBecomingKeyWindow:(BOOL)prevent { |
846 canBecomeKeyWindow_ = !prevent; | 846 canBecomeKeyWindow_ = !prevent; |
847 } | 847 } |
848 | 848 |
849 - (void)fullScreenModeChanged:(bool)isFullScreen { | 849 - (void)fullScreenModeChanged:(bool)isFullScreen { |
850 [self updateWindowLevel]; | 850 [self updateWindowLevel]; |
851 | 851 |
852 // The full-screen window is in normal level and changing the panel window to | 852 // If the panel is not always on top, its z-order should not be affected if |
853 // same normal level will not move it below the full-screen window. Thus we | 853 // some other window enters fullscreen mode. |
854 // need to reorder the panel window. | 854 if (!windowShim_->panel()->IsAlwaysOnTop()) |
| 855 return; |
| 856 |
| 857 // The full-screen window is in normal level and changing the panel window |
| 858 // to same normal level will not move it below the full-screen window. Thus |
| 859 // we need to reorder the panel window. |
855 if (isFullScreen) | 860 if (isFullScreen) |
856 [[self window] orderBack:nil]; | 861 [[self window] orderBack:nil]; |
857 else | 862 else |
858 [[self window] orderFrontRegardless]; | 863 [[self window] orderFrontRegardless]; |
859 } | 864 } |
860 | 865 |
861 - (BOOL)canBecomeKeyWindow { | 866 - (BOOL)canBecomeKeyWindow { |
862 // Panel can only gain focus if it is expanded. Minimized panels do not | 867 // Panel can only gain focus if it is expanded. Minimized panels do not |
863 // participate in Cmd-~ rotation. | 868 // participate in Cmd-~ rotation. |
864 // TODO(dimich): If it will be ever desired to expand/focus the Panel on | 869 // TODO(dimich): If it will be ever desired to expand/focus the Panel on |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 936 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
932 NSRect contentRect = [[[self window] contentView] convertRect:frameRect | 937 NSRect contentRect = [[[self window] contentView] convertRect:frameRect |
933 fromView:nil]; | 938 fromView:nil]; |
934 contentRect.size.height -= panel::kTitlebarHeight; | 939 contentRect.size.height -= panel::kTitlebarHeight; |
935 if (contentRect.size.height < 0) | 940 if (contentRect.size.height < 0) |
936 contentRect.size.height = 0; | 941 contentRect.size.height = 0; |
937 return contentRect; | 942 return contentRect; |
938 } | 943 } |
939 | 944 |
940 @end | 945 @end |
OLD | NEW |