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 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 collectionBehavior |= NSWindowCollectionBehaviorCanJoinAllSpaces; | 916 collectionBehavior |= NSWindowCollectionBehaviorCanJoinAllSpaces; |
917 [[self window] setCollectionBehavior:collectionBehavior]; | 917 [[self window] setCollectionBehavior:collectionBehavior]; |
918 } | 918 } |
919 | 919 |
920 - (void)enableResizeByMouse:(BOOL)enable { | 920 - (void)enableResizeByMouse:(BOOL)enable { |
921 if (![self isWindowLoaded]) | 921 if (![self isWindowLoaded]) |
922 return; | 922 return; |
923 [[self window] invalidateCursorRectsForView:overlayView_]; | 923 [[self window] invalidateCursorRectsForView:overlayView_]; |
924 } | 924 } |
925 | 925 |
| 926 - (void)showShadow:(BOOL)show { |
| 927 if (![self isWindowLoaded]) |
| 928 return; |
| 929 [[self window] setHasShadow:show]; |
| 930 } |
| 931 |
926 // We have custom implementation of these because our titlebar height is custom | 932 // We have custom implementation of these because our titlebar height is custom |
927 // and does not match the standard one. | 933 // and does not match the standard one. |
928 - (NSRect)frameRectForContentRect:(NSRect)contentRect { | 934 - (NSRect)frameRectForContentRect:(NSRect)contentRect { |
929 // contentRect is in contentView coord system. We should add a titlebar on top | 935 // contentRect is in contentView coord system. We should add a titlebar on top |
930 // and then convert to the windows coord system. | 936 // and then convert to the windows coord system. |
931 contentRect.size.height += panel::kTitlebarHeight; | 937 contentRect.size.height += panel::kTitlebarHeight; |
932 NSRect frameRect = [[[self window] contentView] convertRect:contentRect | 938 NSRect frameRect = [[[self window] contentView] convertRect:contentRect |
933 toView:nil]; | 939 toView:nil]; |
934 return frameRect; | 940 return frameRect; |
935 } | 941 } |
936 | 942 |
937 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 943 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
938 NSRect contentRect = [[[self window] contentView] convertRect:frameRect | 944 NSRect contentRect = [[[self window] contentView] convertRect:frameRect |
939 fromView:nil]; | 945 fromView:nil]; |
940 contentRect.size.height -= panel::kTitlebarHeight; | 946 contentRect.size.height -= panel::kTitlebarHeight; |
941 if (contentRect.size.height < 0) | 947 if (contentRect.size.height < 0) |
942 contentRect.size.height = 0; | 948 contentRect.size.height = 0; |
943 return contentRect; | 949 return contentRect; |
944 } | 950 } |
945 | 951 |
946 @end | 952 @end |
OLD | NEW |