| 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/panels/panel_window_controller_cocoa.h" | 5 #include "chrome/browser/ui/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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 const int kMinimumWindowSize = 1; | 47 const int kMinimumWindowSize = 1; |
| 48 const double kBoundsAnimationSpeedPixelsPerSecond = 1000; | 48 const double kBoundsAnimationSpeedPixelsPerSecond = 1000; |
| 49 const double kBoundsAnimationMaxDurationSeconds = 0.18; | 49 const double kBoundsAnimationMaxDurationSeconds = 0.18; |
| 50 | 50 |
| 51 // Resize edge thickness, in screen pixels. | 51 // Resize edge thickness, in screen pixels. |
| 52 const double kWidthOfMouseResizeArea = 4.0; | 52 const double kWidthOfMouseResizeArea = 4.0; |
| 53 // The distance the user has to move the mouse while keeping the left button | 53 // The distance the user has to move the mouse while keeping the left button |
| 54 // down before panel resizing operation actually starts. | 54 // down before panel resizing operation actually starts. |
| 55 const double kDragThreshold = 3.0; | 55 const double kDragThreshold = 3.0; |
| 56 | 56 |
| 57 // Replicate specific 10.6 SDK declarations for building with prior SDKs. | |
| 58 #if !defined(MAC_OS_X_VERSION_10_6) || \ | |
| 59 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | |
| 60 | |
| 61 enum { | |
| 62 NSWindowCollectionBehaviorParticipatesInCycle = 1 << 5 | |
| 63 }; | |
| 64 | |
| 65 #endif // MAC_OS_X_VERSION_10_6 | |
| 66 | |
| 67 @interface PanelWindowControllerCocoa (PanelsCanBecomeKey) | 57 @interface PanelWindowControllerCocoa (PanelsCanBecomeKey) |
| 68 // Internal helper method for extracting the total number of panel windows | 58 // Internal helper method for extracting the total number of panel windows |
| 69 // from the panel manager. Used to decide if panel can become the key window. | 59 // from the panel manager. Used to decide if panel can become the key window. |
| 70 - (int)numPanels; | 60 - (int)numPanels; |
| 71 @end | 61 @end |
| 72 | 62 |
| 73 @implementation PanelWindowCocoaImpl | 63 @implementation PanelWindowCocoaImpl |
| 74 // The panels cannot be reduced to 3-px windows on the edge of the screen | 64 // The panels cannot be reduced to 3-px windows on the edge of the screen |
| 75 // active area (above Dock). Default constraining logic makes at least a height | 65 // active area (above Dock). Default constraining logic makes at least a height |
| 76 // of the titlebar visible, so the user could still grab it. We do 'restore' | 66 // of the titlebar visible, so the user could still grab it. We do 'restore' |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 1035 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
| 1046 NSRect contentRect = [[[self window] contentView] convertRect:frameRect | 1036 NSRect contentRect = [[[self window] contentView] convertRect:frameRect |
| 1047 fromView:nil]; | 1037 fromView:nil]; |
| 1048 contentRect.size.height -= panel::kTitlebarHeight; | 1038 contentRect.size.height -= panel::kTitlebarHeight; |
| 1049 if (contentRect.size.height < 0) | 1039 if (contentRect.size.height < 0) |
| 1050 contentRect.size.height = 0; | 1040 contentRect.size.height = 0; |
| 1051 return contentRect; | 1041 return contentRect; |
| 1052 } | 1042 } |
| 1053 | 1043 |
| 1054 @end | 1044 @end |
| OLD | NEW |