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)setHasShadow:(BOOL)hasShadow { |
| 927 [[self window] setHasShadow:hasShadow]; |
| 928 } |
| 929 |
926 // We have custom implementation of these because our titlebar height is custom | 930 // We have custom implementation of these because our titlebar height is custom |
927 // and does not match the standard one. | 931 // and does not match the standard one. |
928 - (NSRect)frameRectForContentRect:(NSRect)contentRect { | 932 - (NSRect)frameRectForContentRect:(NSRect)contentRect { |
929 // contentRect is in contentView coord system. We should add a titlebar on top | 933 // contentRect is in contentView coord system. We should add a titlebar on top |
930 // and then convert to the windows coord system. | 934 // and then convert to the windows coord system. |
931 contentRect.size.height += panel::kTitlebarHeight; | 935 contentRect.size.height += panel::kTitlebarHeight; |
932 NSRect frameRect = [[[self window] contentView] convertRect:contentRect | 936 NSRect frameRect = [[[self window] contentView] convertRect:contentRect |
933 toView:nil]; | 937 toView:nil]; |
934 return frameRect; | 938 return frameRect; |
935 } | 939 } |
936 | 940 |
937 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 941 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
938 NSRect contentRect = [[[self window] contentView] convertRect:frameRect | 942 NSRect contentRect = [[[self window] contentView] convertRect:frameRect |
939 fromView:nil]; | 943 fromView:nil]; |
940 contentRect.size.height -= panel::kTitlebarHeight; | 944 contentRect.size.height -= panel::kTitlebarHeight; |
941 if (contentRect.size.height < 0) | 945 if (contentRect.size.height < 0) |
942 contentRect.size.height = 0; | 946 contentRect.size.height = 0; |
943 return contentRect; | 947 return contentRect; |
944 } | 948 } |
945 | 949 |
946 @end | 950 @end |
OLD | NEW |