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_controller.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
6 | 6 |
7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <limits> | 10 #include <limits> |
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 } | 1577 } |
1578 | 1578 |
1579 - (void)setFrameOfActiveTab:(NSRect)frame { | 1579 - (void)setFrameOfActiveTab:(NSRect)frame { |
1580 NSView* view = [self activeTabView]; | 1580 NSView* view = [self activeTabView]; |
1581 NSValue* identifier = [NSValue valueWithPointer:view]; | 1581 NSValue* identifier = [NSValue valueWithPointer:view]; |
1582 [targetFrames_ setObject:[NSValue valueWithRect:frame] | 1582 [targetFrames_ setObject:[NSValue valueWithRect:frame] |
1583 forKey:identifier]; | 1583 forKey:identifier]; |
1584 [view setFrame:frame]; | 1584 [view setFrame:frame]; |
1585 } | 1585 } |
1586 | 1586 |
| 1587 - (TabStripModel*)tabStripModel { |
| 1588 return tabStripModel_; |
| 1589 } |
| 1590 |
1587 - (NSView*)activeTabView { | 1591 - (NSView*)activeTabView { |
1588 int activeIndex = tabStripModel_->active_index(); | 1592 int activeIndex = tabStripModel_->active_index(); |
1589 // Take closing tabs into account. They can't ever be selected. | 1593 // Take closing tabs into account. They can't ever be selected. |
1590 activeIndex = [self indexFromModelIndex:activeIndex]; | 1594 activeIndex = [self indexFromModelIndex:activeIndex]; |
1591 return [self viewAtIndex:activeIndex]; | 1595 return [self viewAtIndex:activeIndex]; |
1592 } | 1596 } |
1593 | 1597 |
1594 // Find the model index based on the x coordinate of the placeholder. If there | 1598 // Find the model index based on the x coordinate of the placeholder. If there |
1595 // is no placeholder, this returns the end of the tab strip. Closing tabs are | 1599 // is no placeholder, this returns the end of the tab strip. Closing tabs are |
1596 // not considered in computing the index. | 1600 // not considered in computing the index. |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 NSInteger index = [self indexFromModelIndex:modelIndex]; | 2111 NSInteger index = [self indexFromModelIndex:modelIndex]; |
2108 BrowserWindowController* controller = | 2112 BrowserWindowController* controller = |
2109 (BrowserWindowController*)[[switchView_ window] windowController]; | 2113 (BrowserWindowController*)[[switchView_ window] windowController]; |
2110 DCHECK(index >= 0); | 2114 DCHECK(index >= 0); |
2111 if (index >= 0) { | 2115 if (index >= 0) { |
2112 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; | 2116 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; |
2113 } | 2117 } |
2114 } | 2118 } |
2115 | 2119 |
2116 @end | 2120 @end |
OLD | NEW |