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 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 // (taken care of by |MAX()| when calculating tab sizes). | 868 // (taken care of by |MAX()| when calculating tab sizes). |
869 CGFloat availableSpace = 0; | 869 CGFloat availableSpace = 0; |
870 if (verticalLayout_) { | 870 if (verticalLayout_) { |
871 availableSpace = NSHeight([tabStripView_ bounds]); | 871 availableSpace = NSHeight([tabStripView_ bounds]); |
872 } else { | 872 } else { |
873 if ([self inRapidClosureMode]) { | 873 if ([self inRapidClosureMode]) { |
874 availableSpace = availableResizeWidth_; | 874 availableSpace = availableResizeWidth_; |
875 } else { | 875 } else { |
876 availableSpace = NSWidth([tabStripView_ frame]); | 876 availableSpace = NSWidth([tabStripView_ frame]); |
877 | 877 |
878 // Account for the widths of the new tab button, the incognito badge, and | 878 // Account for the widths of the new tab button or the avatar, if any/all |
879 // the fullscreen button if any/all are present. | 879 // are present. |
880 availableSpace -= NSWidth([newTabButton_ frame]) + kNewTabButtonOffset; | 880 availableSpace -= NSWidth([newTabButton_ frame]) + kNewTabButtonOffset; |
881 if (browser_->profile()->IsOffTheRecord()) | 881 if (browser_->profile()->IsOffTheRecord()) |
882 availableSpace -= kIncognitoBadgeTabStripShrink; | 882 availableSpace -= kIncognitoBadgeTabStripShrink; |
883 if ([[tabStripView_ window] | |
884 respondsToSelector:@selector(toggleFullScreen:)]) { | |
885 NSButton* fullscreenButton = [[tabStripView_ window] | |
886 standardWindowButton:NSWindowFullScreenButton]; | |
887 if (fullscreenButton) | |
888 availableSpace -= [fullscreenButton frame].size.width; | |
889 } | |
890 } | 883 } |
891 availableSpace -= [self indentForControls]; | 884 availableSpace -= [self indentForControls]; |
892 } | 885 } |
893 | 886 |
894 // This may be negative, but that's okay (taken care of by |MAX()| when | 887 // This may be negative, but that's okay (taken care of by |MAX()| when |
895 // calculating tab sizes). "mini" tabs in horizontal mode just get a special | 888 // calculating tab sizes). "mini" tabs in horizontal mode just get a special |
896 // section, they don't change size. | 889 // section, they don't change size. |
897 CGFloat availableSpaceForNonMini = availableSpace; | 890 CGFloat availableSpaceForNonMini = availableSpace; |
898 if (!verticalLayout_) { | 891 if (!verticalLayout_) { |
899 availableSpaceForNonMini -= | 892 availableSpaceForNonMini -= |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 } | 2121 } |
2129 | 2122 |
2130 std::string profileName = browser_->profile()->GetPrefs()->GetString( | 2123 std::string profileName = browser_->profile()->GetPrefs()->GetString( |
2131 prefs::kGoogleServicesUsername); | 2124 prefs::kGoogleServicesUsername); |
2132 [profileMenuButton_ setProfileDisplayName: | 2125 [profileMenuButton_ setProfileDisplayName: |
2133 [NSString stringWithUTF8String:profileName.c_str()]]; | 2126 [NSString stringWithUTF8String:profileName.c_str()]]; |
2134 [profileMenuButton_ setHidden:NO]; | 2127 [profileMenuButton_ setHidden:NO]; |
2135 } | 2128 } |
2136 | 2129 |
2137 @end | 2130 @end |
OLD | NEW |