| 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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 if (profileMenuButton_ && ![profileMenuButton_ isHidden]) { | 1031 if (profileMenuButton_ && ![profileMenuButton_ isHidden]) { |
| 1032 CGFloat maxX; | 1032 CGFloat maxX; |
| 1033 if ([newTabButton_ isHidden]) { | 1033 if ([newTabButton_ isHidden]) { |
| 1034 maxX = std::max(offset, NSMaxX(placeholderFrame_) - kTabOverlap); | 1034 maxX = std::max(offset, NSMaxX(placeholderFrame_) - kTabOverlap); |
| 1035 } else { | 1035 } else { |
| 1036 maxX = NSMaxX(newTabTargetFrame_); | 1036 maxX = NSMaxX(newTabTargetFrame_); |
| 1037 } | 1037 } |
| 1038 NSRect profileMenuButtonFrame = [profileMenuButton_ frame]; | 1038 NSRect profileMenuButtonFrame = [profileMenuButton_ frame]; |
| 1039 NSSize minSize = [profileMenuButton_ minControlSize]; | 1039 NSSize minSize = [profileMenuButton_ minControlSize]; |
| 1040 | 1040 |
| 1041 // Make room for the full screen button if necessary. |
| 1042 if (!hasUpdatedProfileMenuButtonXOffset_) { |
| 1043 hasUpdatedProfileMenuButtonXOffset_ = YES; |
| 1044 if ([[profileMenuButton_ window] |
| 1045 respondsToSelector:@selector(toggleFullScreen:)]) { |
| 1046 NSButton* fullscreenButton = [[profileMenuButton_ window] |
| 1047 standardWindowButton:NSWindowFullScreenButton]; |
| 1048 if (fullscreenButton) { |
| 1049 profileMenuButtonFrame.origin.x = NSMinX([fullscreenButton frame]) - |
| 1050 NSWidth(profileMenuButtonFrame) - kProfileMenuButtonOffset; |
| 1051 } |
| 1052 } |
| 1053 } |
| 1054 |
| 1041 // TODO(sail): Animate this. | 1055 // TODO(sail): Animate this. |
| 1042 CGFloat availableWidth = NSMaxX(profileMenuButtonFrame) - maxX - | 1056 CGFloat availableWidth = NSMaxX(profileMenuButtonFrame) - maxX - |
| 1043 kProfileMenuButtonOffset; | 1057 kProfileMenuButtonOffset; |
| 1044 if (availableWidth > minSize.width) { | 1058 if (availableWidth > minSize.width) { |
| 1045 [profileMenuButton_ setShouldShowProfileDisplayName:YES]; | 1059 [profileMenuButton_ setShouldShowProfileDisplayName:YES]; |
| 1046 } else { | 1060 } else { |
| 1047 [profileMenuButton_ setShouldShowProfileDisplayName:NO]; | 1061 [profileMenuButton_ setShouldShowProfileDisplayName:NO]; |
| 1048 } | 1062 } |
| 1049 | 1063 |
| 1050 NSSize desiredSize = [profileMenuButton_ desiredControlSize]; | 1064 NSSize desiredSize = [profileMenuButton_ desiredControlSize]; |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2088 } | 2102 } |
| 2089 | 2103 |
| 2090 NSString* menuTitle = | 2104 NSString* menuTitle = |
| 2091 l10n_util::GetNSStringWithFixup(IDS_PROFILES_CREATE_NEW_PROFILE_OPTION); | 2105 l10n_util::GetNSStringWithFixup(IDS_PROFILES_CREATE_NEW_PROFILE_OPTION); |
| 2092 [menu addItemWithTitle:menuTitle | 2106 [menu addItemWithTitle:menuTitle |
| 2093 action:NULL | 2107 action:NULL |
| 2094 keyEquivalent:@""]; | 2108 keyEquivalent:@""]; |
| 2095 } | 2109 } |
| 2096 | 2110 |
| 2097 @end | 2111 @end |
| OLD | NEW |