Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm

Issue 1775223002: Prepare chrome/ for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" 11 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h"
12 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h" 12 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h"
13 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 13 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
14 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 14 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
15 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 15 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
16 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" 16 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h"
17 #include "ui/base/cocoa/cocoa_base_utils.h"
17 #include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h" 18 #include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h"
18 19
19 const CGFloat kTearDistance = 36.0; 20 const CGFloat kTearDistance = 36.0;
20 const NSTimeInterval kTearDuration = 0.333; 21 const NSTimeInterval kTearDuration = 0.333;
21 22
22 // Returns whether |screenPoint| is inside the bounds of |view|. 23 // Returns whether |screenPoint| is inside the bounds of |view|.
23 static BOOL PointIsInsideView(NSPoint screenPoint, NSView* view) { 24 static BOOL PointIsInsideView(NSPoint screenPoint, NSView* view) {
24 if ([view window] == nil) 25 if ([view window] == nil)
25 return NO; 26 return NO;
26 NSPoint windowPoint = [[view window] convertScreenToBase:screenPoint]; 27 NSPoint windowPoint =
28 ui::ConvertPointFromScreenToWindow([view window], screenPoint);
27 NSPoint viewPoint = [view convertPoint:windowPoint fromView:nil]; 29 NSPoint viewPoint = [view convertPoint:windowPoint fromView:nil];
28 return [view mouse:viewPoint inRect:[view bounds]]; 30 return [view mouse:viewPoint inRect:[view bounds]];
29 } 31 }
30 32
31 @interface TabStripDragController (Private) 33 @interface TabStripDragController (Private)
32 - (NSArray*)selectedTabViews; 34 - (NSArray*)selectedTabViews;
33 - (BOOL)canDragSelectedTabs; 35 - (BOOL)canDragSelectedTabs;
34 - (void)resetDragControllers; 36 - (void)resetDragControllers;
35 - (NSArray*)dropTargetsForController:(TabWindowController*)dragController; 37 - (NSArray*)dropTargetsForController:(TabWindowController*)dragController;
36 - (void)setWindowBackgroundVisibility:(BOOL)shouldBeVisible; 38 - (void)setWindowBackgroundVisibility:(BOOL)shouldBeVisible;
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 if (![[targetController_ window] isKeyWindow]) 378 if (![[targetController_ window] isKeyWindow])
377 [[targetController_ window] orderFront:nil]; 379 [[targetController_ window] orderFront:nil];
378 380
379 // Compute where placeholder should go and insert it into the 381 // Compute where placeholder should go and insert it into the
380 // destination tab strip. 382 // destination tab strip.
381 // The placeholder frame is the rect that contains all dragged tabs. 383 // The placeholder frame is the rect that contains all dragged tabs.
382 NSRect tabFrame = NSZeroRect; 384 NSRect tabFrame = NSZeroRect;
383 for (NSView* tabView in [draggedController_ tabViews]) { 385 for (NSView* tabView in [draggedController_ tabViews]) {
384 tabFrame = NSUnionRect(tabFrame, [tabView frame]); 386 tabFrame = NSUnionRect(tabFrame, [tabView frame]);
385 } 387 }
386 tabFrame.origin = [dragWindow_ convertBaseToScreen:tabFrame.origin]; 388 tabFrame = [dragWindow_ convertRectToScreen:tabFrame];
387 tabFrame.origin = [[targetController_ window] 389 tabFrame = [[targetController_ window] convertRectFromScreen:tabFrame];
388 convertScreenToBase:tabFrame.origin];
389 tabFrame = [[targetController_ tabStripView] 390 tabFrame = [[targetController_ tabStripView]
390 convertRect:tabFrame fromView:nil]; 391 convertRect:tabFrame fromView:nil];
Nico 2016/03/10 18:32:43 this variable sure is getting transformed a lot
391 [targetController_ insertPlaceholderForTab:[draggedTab_ tabView] 392 [targetController_ insertPlaceholderForTab:[draggedTab_ tabView]
392 frame:tabFrame]; 393 frame:tabFrame];
393 [targetController_ layoutTabs]; 394 [targetController_ layoutTabs];
394 } else { 395 } else {
395 [dragWindow_ makeKeyAndOrderFront:nil]; 396 [dragWindow_ makeKeyAndOrderFront:nil];
396 } 397 }
397 398
398 // Adjust the visibility of the window background. If there is a drop target, 399 // Adjust the visibility of the window background. If there is a drop target,
399 // we want to hide the window background so the tab stands out for 400 // we want to hide the window background so the tab stands out for
400 // positioning. If not, we want to show it so it looks like a new window will 401 // positioning. If not, we want to show it so it looks like a new window will
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 [[targetController_ window] makeMainWindow]; 555 [[targetController_ window] makeMainWindow];
555 } else { 556 } else {
556 [dragWindow_ setAlphaValue:0.5]; 557 [dragWindow_ setAlphaValue:0.5];
557 [[draggedController_ overlayWindow] setHasShadow:NO]; 558 [[draggedController_ overlayWindow] setHasShadow:NO];
558 [[draggedController_ window] makeMainWindow]; 559 [[draggedController_ window] makeMainWindow];
559 } 560 }
560 chromeIsVisible_ = shouldBeVisible; 561 chromeIsVisible_ = shouldBeVisible;
561 } 562 }
562 563
563 @end 564 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698