OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 if (verticalLayout_) { | 833 if (verticalLayout_) { |
834 availableSpace = NSHeight([tabStripView_ bounds]); | 834 availableSpace = NSHeight([tabStripView_ bounds]); |
835 } else { | 835 } else { |
836 if ([self inRapidClosureMode]) { | 836 if ([self inRapidClosureMode]) { |
837 availableSpace = availableResizeWidth_; | 837 availableSpace = availableResizeWidth_; |
838 } else { | 838 } else { |
839 availableSpace = NSWidth([tabStripView_ frame]); | 839 availableSpace = NSWidth([tabStripView_ frame]); |
840 | 840 |
841 // Account for the width of the new tab button. | 841 // Account for the width of the new tab button. |
842 availableSpace -= NSWidth([newTabButton_ frame]) + kNewTabButtonOffset; | 842 availableSpace -= NSWidth([newTabButton_ frame]) + kNewTabButtonOffset; |
| 843 |
| 844 // Account for the right-side controls if not in rapid closure mode. |
| 845 // (In rapid closure mode, the available width is set based on the |
| 846 // position of the rightmost tab, not based on the width of the tab strip, |
| 847 // so the right controls have already been accounted for.) |
| 848 availableSpace -= [self rightIndentForControls]; |
843 } | 849 } |
| 850 |
| 851 // Need to leave room for the left-side controls even in rapid closure mode. |
844 availableSpace -= [self leftIndentForControls]; | 852 availableSpace -= [self leftIndentForControls]; |
845 availableSpace -= [self rightIndentForControls]; | |
846 } | 853 } |
847 | 854 |
848 // This may be negative, but that's okay (taken care of by |MAX()| when | 855 // This may be negative, but that's okay (taken care of by |MAX()| when |
849 // calculating tab sizes). "mini" tabs in horizontal mode just get a special | 856 // calculating tab sizes). "mini" tabs in horizontal mode just get a special |
850 // section, they don't change size. | 857 // section, they don't change size. |
851 CGFloat availableSpaceForNonMini = availableSpace; | 858 CGFloat availableSpaceForNonMini = availableSpace; |
852 if (!verticalLayout_) { | 859 if (!verticalLayout_) { |
853 availableSpaceForNonMini -= | 860 availableSpaceForNonMini -= |
854 [self numberOfOpenMiniTabs] * (kMiniTabWidth - kTabOverlap); | 861 [self numberOfOpenMiniTabs] * (kMiniTabWidth - kTabOverlap); |
855 } | 862 } |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 NSInteger index = [self indexFromModelIndex:modelIndex]; | 2028 NSInteger index = [self indexFromModelIndex:modelIndex]; |
2022 BrowserWindowController* controller = | 2029 BrowserWindowController* controller = |
2023 (BrowserWindowController*)[[switchView_ window] windowController]; | 2030 (BrowserWindowController*)[[switchView_ window] windowController]; |
2024 DCHECK(index >= 0); | 2031 DCHECK(index >= 0); |
2025 if (index >= 0) { | 2032 if (index >= 0) { |
2026 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; | 2033 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; |
2027 } | 2034 } |
2028 } | 2035 } |
2029 | 2036 |
2030 @end | 2037 @end |
OLD | NEW |