| 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 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
| 8 | 8 |
| 9 #include "base/mac/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
| 10 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // in the tab strip. | 204 // in the tab strip. |
| 205 CGFloat tabWidthBeyondRightEdge = | 205 CGFloat tabWidthBeyondRightEdge = |
| 206 MAX(NSMaxX(newTabFrame) - [tabStrip_ tabAreaRightEdge], 0.0); | 206 MAX(NSMaxX(newTabFrame) - [tabStrip_ tabAreaRightEdge], 0.0); |
| 207 if (tabWidthBeyondRightEdge) { | 207 if (tabWidthBeyondRightEdge) { |
| 208 // Adjust the tab's x-origin so that it just touches the right edge of | 208 // Adjust the tab's x-origin so that it just touches the right edge of |
| 209 // the tab area. | 209 // the tab area. |
| 210 newTabFrame.origin.x -= tabWidthBeyondRightEdge; | 210 newTabFrame.origin.x -= tabWidthBeyondRightEdge; |
| 211 // Offset the new window's drag location so that the tab will still be | 211 // Offset the new window's drag location so that the tab will still be |
| 212 // positioned correctly beneath the mouse (being careful to convert the | 212 // positioned correctly beneath the mouse (being careful to convert the |
| 213 // view frame offset to screen coordinates). | 213 // view frame offset to screen coordinates). |
| 214 if (base::mac::IsOSLionOrLater()) { | 214 NSWindow* tabViewWindow = [[draggedTab_ tabView] window]; |
| 215 NSWindow* tabViewWindow = [[draggedTab_ tabView] window]; | 215 horizDragOffset_ = [tabViewWindow convertRectToScreen: |
| 216 horizDragOffset_ = [tabViewWindow convertRectToScreen: | 216 NSMakeRect(0.0, 0.0, tabWidthBeyondRightEdge, 1.0)].size.width; |
| 217 NSMakeRect(0.0, 0.0, tabWidthBeyondRightEdge, 1.0)].size.width; | |
| 218 } else { | |
| 219 horizDragOffset_ = tabWidthBeyondRightEdge; | |
| 220 } | |
| 221 } | 217 } |
| 222 | 218 |
| 223 [[draggedTab_ tabView] setFrameOrigin:newTabFrame.origin]; | 219 [[draggedTab_ tabView] setFrameOrigin:newTabFrame.origin]; |
| 224 } else { | 220 } else { |
| 225 // Still dragging within the tab strip, wait for the next drag event. | 221 // Still dragging within the tab strip, wait for the next drag event. |
| 226 return; | 222 return; |
| 227 } | 223 } |
| 228 } | 224 } |
| 229 | 225 |
| 230 NSPoint thisPoint = [NSEvent mouseLocation]; | 226 NSPoint thisPoint = [NSEvent mouseLocation]; |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 [[targetController_ window] makeMainWindow]; | 555 [[targetController_ window] makeMainWindow]; |
| 560 } else { | 556 } else { |
| 561 [dragWindow_ setAlphaValue:0.5]; | 557 [dragWindow_ setAlphaValue:0.5]; |
| 562 [[draggedController_ overlayWindow] setHasShadow:NO]; | 558 [[draggedController_ overlayWindow] setHasShadow:NO]; |
| 563 [[draggedController_ window] makeMainWindow]; | 559 [[draggedController_ window] makeMainWindow]; |
| 564 } | 560 } |
| 565 chromeIsVisible_ = shouldBeVisible; | 561 chromeIsVisible_ = shouldBeVisible; |
| 566 } | 562 } |
| 567 | 563 |
| 568 @end | 564 @end |
| OLD | NEW |