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

Side by Side Diff: chrome/browser/cocoa/browser_window_controller.mm

Issue 306006: Make dropped tabs animate from where they were dropped. Make room for the ful... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/cocoa/tab_strip_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <Carbon/Carbon.h> 5 #include <Carbon/Carbon.h>
6 6
7 #include "base/mac_util.h" 7 #include "base/mac_util.h"
8 #include "base/scoped_nsdisable_screen_updates.h" 8 #include "base/scoped_nsdisable_screen_updates.h"
9 #import "base/scoped_nsobject.h" 9 #import "base/scoped_nsobject.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 if (!isBrowser) return; 711 if (!isBrowser) return;
712 BrowserWindowController* dragBWC = (BrowserWindowController*)dragController; 712 BrowserWindowController* dragBWC = (BrowserWindowController*)dragController;
713 int index = [dragBWC->tabStripController_ indexForTabView:view]; 713 int index = [dragBWC->tabStripController_ indexForTabView:view];
714 TabContents* contents = 714 TabContents* contents =
715 dragBWC->browser_->tabstrip_model()->GetTabContentsAt(index); 715 dragBWC->browser_->tabstrip_model()->GetTabContentsAt(index);
716 // The tab contents may have gone away if given a window.close() while it 716 // The tab contents may have gone away if given a window.close() while it
717 // is being dragged. If so, bail, we've got nothing to drop. 717 // is being dragged. If so, bail, we've got nothing to drop.
718 if (!contents) 718 if (!contents)
719 return; 719 return;
720 720
721 // Convert |view|'s frame (which starts in the source tab strip's coordinate
722 // system) to the coordinate system of the destination tab strip. This needs
723 // to be done before being detached so the window transforms can be
724 // performed.
725 NSRect destinationFrame = [view frame];
726 NSPoint tabOrigin = destinationFrame.origin;
727 tabOrigin = [[dragController tabStripView] convertPoint:tabOrigin
728 toView:nil];
729 tabOrigin = [[view window] convertBaseToScreen:tabOrigin];
730 tabOrigin = [[self window] convertScreenToBase:tabOrigin];
731 tabOrigin = [[self tabStripView] convertPoint:tabOrigin fromView:nil];
732 destinationFrame.origin = tabOrigin;
733
721 // Now that we have enough information about the tab, we can remove it from 734 // Now that we have enough information about the tab, we can remove it from
722 // the dragging window. We need to do this *before* we add it to the new 735 // the dragging window. We need to do this *before* we add it to the new
723 // window as this will removes the TabContents' delegate. 736 // window as this will remove the TabContents' delegate.
724 [dragController detachTabView:view]; 737 [dragController detachTabView:view];
725 738
726 // Deposit it into our model at the appropriate location (it already knows 739 // Deposit it into our model at the appropriate location (it already knows
727 // where it should go from tracking the drag). Doing this sets the tab's 740 // where it should go from tracking the drag). Doing this sets the tab's
728 // delegate to be the Browser. 741 // delegate to be the Browser.
729 [tabStripController_ dropTabContents:contents]; 742 [tabStripController_ dropTabContents:contents withFrame:destinationFrame];
730 } else { 743 } else {
731 // Moving within a window. 744 // Moving within a window.
732 int index = [tabStripController_ indexForTabView:view]; 745 int index = [tabStripController_ indexForTabView:view];
733 [tabStripController_ moveTabFromIndex:index]; 746 [tabStripController_ moveTabFromIndex:index];
734 } 747 }
735 748
736 // Remove the placeholder since the drag is now complete. 749 // Remove the placeholder since the drag is now complete.
737 [self removePlaceholder]; 750 [self removePlaceholder];
738 } 751 }
739 752
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 if (frameOverlayInactiveImage) { 1529 if (frameOverlayInactiveImage) {
1517 [theme setValue:frameOverlayInactiveImage 1530 [theme setValue:frameOverlayInactiveImage
1518 forAttribute:@"overlay" 1531 forAttribute:@"overlay"
1519 style:GTMThemeStyleWindow 1532 style:GTMThemeStyleWindow
1520 state:GTMThemeStateInactiveWindow]; 1533 state:GTMThemeStateInactiveWindow];
1521 } 1534 }
1522 1535
1523 return theme; 1536 return theme;
1524 } 1537 }
1525 @end 1538 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cocoa/tab_strip_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698