| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 - (void)prepareForDrag:(NSEvent*)initialMouseDownEvent { | 307 - (void)prepareForDrag:(NSEvent*)initialMouseDownEvent { |
| 308 dragState_ = PANEL_DRAG_CAN_START; | 308 dragState_ = PANEL_DRAG_CAN_START; |
| 309 startMouseLocation_ = [initialMouseDownEvent locationInWindow]; | 309 startMouseLocation_ = [initialMouseDownEvent locationInWindow]; |
| 310 | 310 |
| 311 // Make sure the cursor stays the same during whole resize operation. | 311 // Make sure the cursor stays the same during whole resize operation. |
| 312 // The cursor rects normally do not guarantee the same cursor, since the | 312 // The cursor rects normally do not guarantee the same cursor, since the |
| 313 // mouse may temporarily leave the cursor rect area (or even the window) so | 313 // mouse may temporarily leave the cursor rect area (or even the window) so |
| 314 // the cursor will flicker. Disable cursor rects and grab the current cursor | 314 // the cursor will flicker. Disable cursor rects and grab the current cursor |
| 315 // so we can set it on mouseDragged: events to avoid flicker. | 315 // so we can set it on mouseDragged: events to avoid flicker. |
| 316 [[self window] disableCursorRects]; | 316 [[self window] disableCursorRects]; |
| 317 dragCursor_.reset([NSCursor currentCursor], scoped_policy::RETAIN); | 317 dragCursor_.reset([NSCursor currentCursor], base::scoped_policy::RETAIN); |
| 318 } | 318 } |
| 319 | 319 |
| 320 -(void)cleanupAfterDrag { | 320 -(void)cleanupAfterDrag { |
| 321 dragState_ = PANEL_DRAG_SUPPRESSED; | 321 dragState_ = PANEL_DRAG_SUPPRESSED; |
| 322 [[self window] enableCursorRects]; | 322 [[self window] enableCursorRects]; |
| 323 dragCursor_.reset(); | 323 dragCursor_.reset(); |
| 324 startMouseLocation_ = NSZeroPoint; | 324 startMouseLocation_ = NSZeroPoint; |
| 325 } | 325 } |
| 326 | 326 |
| 327 - (BOOL)exceedsDragThreshold:(NSPoint)mouseLocation { | 327 - (BOOL)exceedsDragThreshold:(NSPoint)mouseLocation { |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 1038 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
| 1039 NSRect contentRect = [[[self window] contentView] convertRect:frameRect | 1039 NSRect contentRect = [[[self window] contentView] convertRect:frameRect |
| 1040 fromView:nil]; | 1040 fromView:nil]; |
| 1041 contentRect.size.height -= panel::kTitlebarHeight; | 1041 contentRect.size.height -= panel::kTitlebarHeight; |
| 1042 if (contentRect.size.height < 0) | 1042 if (contentRect.size.height < 0) |
| 1043 contentRect.size.height = 0; | 1043 contentRect.size.height = 0; |
| 1044 return contentRect; | 1044 return contentRect; |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 @end | 1047 @end |
| OLD | NEW |