| 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/tabpose_window.h" | 5 #import "chrome/browser/ui/cocoa/tabpose_window.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 -kSelectionInset, -kSelectionInset)); | 969 -kSelectionInset, -kSelectionInset)); |
| 970 tileSet_->set_selected_index(newIndex); | 970 tileSet_->set_selected_index(newIndex); |
| 971 | 971 |
| 972 [self updateClosebuttonLayersVisibility]; | 972 [self updateClosebuttonLayersVisibility]; |
| 973 } | 973 } |
| 974 | 974 |
| 975 - (void)addLayersForTile:(tabpose::Tile&)tile | 975 - (void)addLayersForTile:(tabpose::Tile&)tile |
| 976 showZoom:(BOOL)showZoom | 976 showZoom:(BOOL)showZoom |
| 977 slomo:(BOOL)slomo | 977 slomo:(BOOL)slomo |
| 978 animationDelegate:(id)animationDelegate { | 978 animationDelegate:(id)animationDelegate { |
| 979 scoped_nsobject<CALayer> layer([[ThumbnailLayer alloc] | 979 base::scoped_nsobject<CALayer> layer( |
| 980 initWithWebContents:tile.web_contents() | 980 [[ThumbnailLayer alloc] initWithWebContents:tile.web_contents() |
| 981 fullSize:tile.GetStartRectRelativeTo( | 981 fullSize:tile.GetStartRectRelativeTo( |
| 982 tileSet_->selected_tile()).size]); | 982 tileSet_->selected_tile()).size]); |
| 983 [layer setNeedsDisplay]; | 983 [layer setNeedsDisplay]; |
| 984 | 984 |
| 985 NSTimeInterval interval = | 985 NSTimeInterval interval = |
| 986 kDefaultAnimationDuration * (slomo ? kSlomoFactor : 1); | 986 kDefaultAnimationDuration * (slomo ? kSlomoFactor : 1); |
| 987 | 987 |
| 988 // Background color as placeholder for now. | 988 // Background color as placeholder for now. |
| 989 layer.get().backgroundColor = CGColorGetConstantColor(kCGColorWhite); | 989 layer.get().backgroundColor = CGColorGetConstantColor(kCGColorWhite); |
| 990 if (showZoom) { | 990 if (showZoom) { |
| 991 AnimateCALayerFrameFromTo( | 991 AnimateCALayerFrameFromTo( |
| 992 layer, | 992 layer, |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 | 1604 |
| 1605 - (void)tabMovedWithContents:(content::WebContents*)contents | 1605 - (void)tabMovedWithContents:(content::WebContents*)contents |
| 1606 fromIndex:(NSInteger)from | 1606 fromIndex:(NSInteger)from |
| 1607 toIndex:(NSInteger)to { | 1607 toIndex:(NSInteger)to { |
| 1608 ScopedCAActionSetDuration durationSetter(kObserverChangeAnimationDuration); | 1608 ScopedCAActionSetDuration durationSetter(kObserverChangeAnimationDuration); |
| 1609 | 1609 |
| 1610 // Move tile from |from| to |to|. | 1610 // Move tile from |from| to |to|. |
| 1611 tileSet_->MoveTileFromTo(from, to); | 1611 tileSet_->MoveTileFromTo(from, to); |
| 1612 | 1612 |
| 1613 // Move corresponding layers from |from| to |to|. | 1613 // Move corresponding layers from |from| to |to|. |
| 1614 scoped_nsobject<CALayer> thumbLayer( | 1614 base::scoped_nsobject<CALayer> thumbLayer( |
| 1615 [[allThumbnailLayers_ objectAtIndex:from] retain]); | 1615 [[allThumbnailLayers_ objectAtIndex:from] retain]); |
| 1616 [allThumbnailLayers_ removeObjectAtIndex:from]; | 1616 [allThumbnailLayers_ removeObjectAtIndex:from]; |
| 1617 [allThumbnailLayers_ insertObject:thumbLayer.get() atIndex:to]; | 1617 [allThumbnailLayers_ insertObject:thumbLayer.get() atIndex:to]; |
| 1618 scoped_nsobject<CALayer> faviconLayer( | 1618 base::scoped_nsobject<CALayer> faviconLayer( |
| 1619 [[allFaviconLayers_ objectAtIndex:from] retain]); | 1619 [[allFaviconLayers_ objectAtIndex:from] retain]); |
| 1620 [allFaviconLayers_ removeObjectAtIndex:from]; | 1620 [allFaviconLayers_ removeObjectAtIndex:from]; |
| 1621 [allFaviconLayers_ insertObject:faviconLayer.get() atIndex:to]; | 1621 [allFaviconLayers_ insertObject:faviconLayer.get() atIndex:to]; |
| 1622 scoped_nsobject<CALayer> titleLayer( | 1622 base::scoped_nsobject<CALayer> titleLayer( |
| 1623 [[allTitleLayers_ objectAtIndex:from] retain]); | 1623 [[allTitleLayers_ objectAtIndex:from] retain]); |
| 1624 [allTitleLayers_ removeObjectAtIndex:from]; | 1624 [allTitleLayers_ removeObjectAtIndex:from]; |
| 1625 [allTitleLayers_ insertObject:titleLayer.get() atIndex:to]; | 1625 [allTitleLayers_ insertObject:titleLayer.get() atIndex:to]; |
| 1626 | 1626 |
| 1627 // Update selection. | 1627 // Update selection. |
| 1628 int selectedIndex = tileSet_->selected_index(); | 1628 int selectedIndex = tileSet_->selected_index(); |
| 1629 if (from == selectedIndex) | 1629 if (from == selectedIndex) |
| 1630 selectedIndex = to; | 1630 selectedIndex = to; |
| 1631 else if (from < selectedIndex && selectedIndex <= to) | 1631 else if (from < selectedIndex && selectedIndex <= to) |
| 1632 selectedIndex--; | 1632 selectedIndex--; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1661 tile.set_tab_contents(contents); | 1661 tile.set_tab_contents(contents); |
| 1662 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; | 1662 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; |
| 1663 [thumbLayer setWebContents:contents]; | 1663 [thumbLayer setWebContents:contents]; |
| 1664 } | 1664 } |
| 1665 | 1665 |
| 1666 - (void)tabStripModelDeleted { | 1666 - (void)tabStripModelDeleted { |
| 1667 [self close]; | 1667 [self close]; |
| 1668 } | 1668 } |
| 1669 | 1669 |
| 1670 @end | 1670 @end |
| OLD | NEW |