| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 // If the panel is not resizable, hitTest should have failed and no mouse | 228 // If the panel is not resizable, hitTest should have failed and no mouse |
| 229 // events should have come here. | 229 // events should have come here. |
| 230 DCHECK_NE(panel::NOT_RESIZABLE, panel_->CanResizeByMouse()); | 230 DCHECK_NE(panel::NOT_RESIZABLE, panel_->CanResizeByMouse()); |
| 231 | 231 |
| 232 // Make sure the cursor stays the same during whole resize operation. | 232 // Make sure the cursor stays the same during whole resize operation. |
| 233 // The cursor rects normally do not guarantee the same cursor, since the | 233 // The cursor rects normally do not guarantee the same cursor, since the |
| 234 // mouse may temporarily leave the cursor rect area (or even the window) so | 234 // mouse may temporarily leave the cursor rect area (or even the window) so |
| 235 // the cursor will flicker. Disable cursor rects and grab the current cursor | 235 // the cursor will flicker. Disable cursor rects and grab the current cursor |
| 236 // so we can set it on mouseDragged: events to avoid flicker. | 236 // so we can set it on mouseDragged: events to avoid flicker. |
| 237 [[self window] disableCursorRects]; | 237 [[self window] disableCursorRects]; |
| 238 dragCursor_.reset([NSCursor currentCursor], base::scoped_policy::RETAIN); | 238 dragCursor_.reset([[NSCursor currentCursor] retain]); |
| 239 } | 239 } |
| 240 | 240 |
| 241 - (void)cleanupAfterDrag { | 241 - (void)cleanupAfterDrag { |
| 242 [[self window] enableCursorRects]; | 242 [[self window] enableCursorRects]; |
| 243 dragCursor_.reset(); | 243 dragCursor_.reset(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 - (void)dragStarted:(NSPoint)initialMouseLocation { | 246 - (void)dragStarted:(NSPoint)initialMouseLocation { |
| 247 NSPoint initialMouseLocationScreen = | 247 NSPoint initialMouseLocationScreen = |
| 248 [[self window] convertBaseToScreen:initialMouseLocation]; | 248 [[self window] convertBaseToScreen:initialMouseLocation]; |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 922 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
| 923 NSRect contentRect = [[[self window] contentView] convertRect:frameRect | 923 NSRect contentRect = [[[self window] contentView] convertRect:frameRect |
| 924 fromView:nil]; | 924 fromView:nil]; |
| 925 contentRect.size.height -= panel::kTitlebarHeight; | 925 contentRect.size.height -= panel::kTitlebarHeight; |
| 926 if (contentRect.size.height < 0) | 926 if (contentRect.size.height < 0) |
| 927 contentRect.size.height = 0; | 927 contentRect.size.height = 0; |
| 928 return contentRect; | 928 return contentRect; |
| 929 } | 929 } |
| 930 | 930 |
| 931 @end | 931 @end |
| OLD | NEW |