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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 availableSpace = NSHeight([tabStripView_ bounds]); | 837 availableSpace = NSHeight([tabStripView_ bounds]); |
838 } else { | 838 } else { |
839 if ([self inRapidClosureMode]) { | 839 if ([self inRapidClosureMode]) { |
840 availableSpace = availableResizeWidth_; | 840 availableSpace = availableResizeWidth_; |
841 } else { | 841 } else { |
842 availableSpace = NSWidth([tabStripView_ frame]); | 842 availableSpace = NSWidth([tabStripView_ frame]); |
843 | 843 |
844 BrowserWindowController* controller = | 844 BrowserWindowController* controller = |
845 (BrowserWindowController*)[[tabStripView_ window] windowController]; | 845 (BrowserWindowController*)[[tabStripView_ window] windowController]; |
846 | 846 |
847 // Account for the widths of the new tab button, the avatar, and the | 847 // Account for the widths of the new tab button or the avatar, if any/all |
848 // fullscreen button if any/all are present. | 848 // are present. |
849 availableSpace -= NSWidth([newTabButton_ frame]) + kNewTabButtonOffset; | 849 availableSpace -= NSWidth([newTabButton_ frame]) + kNewTabButtonOffset; |
850 if ([controller respondsToSelector:@selector(shouldShowAvatar)] && | 850 if ([controller respondsToSelector:@selector(shouldShowAvatar)] && |
851 [controller shouldShowAvatar]) { | 851 [controller shouldShowAvatar]) { |
852 availableSpace -= kAvatarTabStripShrink; | 852 availableSpace -= kAvatarTabStripShrink; |
853 } | 853 } |
854 if ([[tabStripView_ window] | |
855 respondsToSelector:@selector(toggleFullScreen:)]) { | |
856 NSButton* fullscreenButton = [[tabStripView_ window] | |
857 standardWindowButton:NSWindowFullScreenButton]; | |
858 if (fullscreenButton) | |
859 availableSpace -= [fullscreenButton frame].size.width; | |
860 } | |
861 } | 854 } |
862 availableSpace -= [self indentForControls]; | 855 availableSpace -= [self indentForControls]; |
863 } | 856 } |
864 | 857 |
865 // This may be negative, but that's okay (taken care of by |MAX()| when | 858 // This may be negative, but that's okay (taken care of by |MAX()| when |
866 // calculating tab sizes). "mini" tabs in horizontal mode just get a special | 859 // calculating tab sizes). "mini" tabs in horizontal mode just get a special |
867 // section, they don't change size. | 860 // section, they don't change size. |
868 CGFloat availableSpaceForNonMini = availableSpace; | 861 CGFloat availableSpaceForNonMini = availableSpace; |
869 if (!verticalLayout_) { | 862 if (!verticalLayout_) { |
870 availableSpaceForNonMini -= | 863 availableSpaceForNonMini -= |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 NSInteger index = [self indexFromModelIndex:modelIndex]; | 2027 NSInteger index = [self indexFromModelIndex:modelIndex]; |
2035 BrowserWindowController* controller = | 2028 BrowserWindowController* controller = |
2036 (BrowserWindowController*)[[switchView_ window] windowController]; | 2029 (BrowserWindowController*)[[switchView_ window] windowController]; |
2037 DCHECK(index >= 0); | 2030 DCHECK(index >= 0); |
2038 if (index >= 0) { | 2031 if (index >= 0) { |
2039 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; | 2032 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; |
2040 } | 2033 } |
2041 } | 2034 } |
2042 | 2035 |
2043 @end | 2036 @end |
OLD | NEW |