Chromium Code Reviews| 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()) { |
|
Dmitry Titov
2013/03/14 01:10:25
early return?
jianli
2013/03/14 19:11:48
Done.
| |
| 855 if (isFullScreen) | 855 // The full-screen window is in normal level and changing the panel window |
| 856 [[self window] orderBack:nil]; | 856 // to same normal level will not move it below the full-screen window. Thus |
| 857 else | 857 // we need to reorder the panel window. |
| 858 [[self window] orderFrontRegardless]; | 858 if (isFullScreen) |
| 859 [[self window] orderBack:nil]; | |
| 860 else | |
| 861 [[self window] orderFrontRegardless]; | |
| 862 } | |
| 859 } | 863 } |
| 860 | 864 |
| 861 - (BOOL)canBecomeKeyWindow { | 865 - (BOOL)canBecomeKeyWindow { |
| 862 // Panel can only gain focus if it is expanded. Minimized panels do not | 866 // Panel can only gain focus if it is expanded. Minimized panels do not |
| 863 // participate in Cmd-~ rotation. | 867 // participate in Cmd-~ rotation. |
| 864 // TODO(dimich): If it will be ever desired to expand/focus the Panel on | 868 // TODO(dimich): If it will be ever desired to expand/focus the Panel on |
| 865 // keyboard navigation or via main menu, the care should be taken to avoid | 869 // keyboard navigation or via main menu, the care should be taken to avoid |
| 866 // cases when minimized Panel is getting keyboard input, invisibly. | 870 // cases when minimized Panel is getting keyboard input, invisibly. |
| 867 return canBecomeKeyWindow_; | 871 return canBecomeKeyWindow_; |
| 868 } | 872 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 931 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 935 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
| 932 NSRect contentRect = [[[self window] contentView] convertRect:frameRect | 936 NSRect contentRect = [[[self window] contentView] convertRect:frameRect |
| 933 fromView:nil]; | 937 fromView:nil]; |
| 934 contentRect.size.height -= panel::kTitlebarHeight; | 938 contentRect.size.height -= panel::kTitlebarHeight; |
| 935 if (contentRect.size.height < 0) | 939 if (contentRect.size.height < 0) |
| 936 contentRect.size.height = 0; | 940 contentRect.size.height = 0; |
| 937 return contentRect; | 941 return contentRect; |
| 938 } | 942 } |
| 939 | 943 |
| 940 @end | 944 @end |
| OLD | NEW |