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/browser_window_controller_private.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 - (CGFloat)layoutTabStripAtMaxY:(CGFloat)maxY | 183 - (CGFloat)layoutTabStripAtMaxY:(CGFloat)maxY |
184 width:(CGFloat)width | 184 width:(CGFloat)width |
185 fullscreen:(BOOL)fullscreen { | 185 fullscreen:(BOOL)fullscreen { |
186 // Nothing to do if no tab strip. | 186 // Nothing to do if no tab strip. |
187 if (![self hasTabStrip]) | 187 if (![self hasTabStrip]) |
188 return maxY; | 188 return maxY; |
189 | 189 |
190 NSView* tabStripView = [self tabStripView]; | 190 NSView* tabStripView = [self tabStripView]; |
191 CGFloat tabStripHeight = NSHeight([tabStripView frame]); | 191 CGFloat tabStripHeight = NSHeight([tabStripView frame]); |
192 maxY -= tabStripHeight; | 192 maxY -= tabStripHeight; |
193 [tabStripView setFrame:NSMakeRect(0, maxY, width, tabStripHeight)]; | 193 NSRect tabStripFrame = NSMakeRect(0, maxY, width, tabStripHeight); |
194 | 194 |
195 // In Yosemite fullscreen, manually add the fullscreen controls to the tab | 195 // In Yosemite fullscreen, manually add the fullscreen controls to the tab |
196 // strip. | 196 // strip. |
197 BOOL addControlsInFullscreen = | 197 BOOL addControlsInFullscreen = |
198 [self isInAppKitFullscreen] && base::mac::IsOSYosemiteOrLater(); | 198 [self isInAppKitFullscreen] && base::mac::IsOSYosemiteOrLater(); |
199 | 199 |
200 // Set left indentation based on fullscreen mode status. | 200 // Set left indentation based on fullscreen mode status. |
201 CGFloat leftIndent = 0; | 201 CGFloat leftIndent = 0; |
202 if (!fullscreen || addControlsInFullscreen) | 202 if (!fullscreen || addControlsInFullscreen) |
203 leftIndent = [[tabStripController_ class] defaultLeftIndentForControls]; | 203 leftIndent = [[tabStripController_ class] defaultLeftIndentForControls]; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 if ([self shouldUseNewAvatarButton]) { | 253 if ([self shouldUseNewAvatarButton]) { |
254 // The new avatar button is to the left of the fullscreen button. | 254 // The new avatar button is to the left of the fullscreen button. |
255 // (The old avatar button is to the right). | 255 // (The old avatar button is to the right). |
256 rightIndent += NSWidth([avatarButton frame]) + kAvatarRightOffset; | 256 rightIndent += NSWidth([avatarButton frame]) + kAvatarRightOffset; |
257 } | 257 } |
258 } else if ([self shouldShowAvatar]) { | 258 } else if ([self shouldShowAvatar]) { |
259 rightIndent += NSWidth([avatarButton frame]) + kAvatarRightOffset; | 259 rightIndent += NSWidth([avatarButton frame]) + kAvatarRightOffset; |
260 } | 260 } |
261 [tabStripController_ setRightIndentForControls:rightIndent]; | 261 [tabStripController_ setRightIndentForControls:rightIndent]; |
262 | 262 |
263 // Go ahead and layout the tabs. | 263 if (!NSEqualRects(tabStripFrame, [tabStripView frame])) { |
Robert Sesek
2014/09/24 17:23:30
I'd copy part of the CL description to a comment h
Andre
2014/09/24 17:59:37
Done.
| |
264 [tabStripController_ layoutTabsWithoutAnimation]; | 264 [tabStripView setFrame:tabStripFrame]; |
265 [tabStripController_ layoutTabsWithoutAnimation]; | |
266 } | |
265 | 267 |
266 return maxY; | 268 return maxY; |
267 } | 269 } |
268 | 270 |
269 - (BOOL)placeBookmarkBarBelowInfoBar { | 271 - (BOOL)placeBookmarkBarBelowInfoBar { |
270 // If we are currently displaying the NTP detached bookmark bar or animating | 272 // If we are currently displaying the NTP detached bookmark bar or animating |
271 // to/from it (from/to anything else), we display the bookmark bar below the | 273 // to/from it (from/to anything else), we display the bookmark bar below the |
272 // info bar. | 274 // info bar. |
273 return [bookmarkBarController_ isInState:BookmarkBar::DETACHED] || | 275 return [bookmarkBarController_ isInState:BookmarkBar::DETACHED] || |
274 [bookmarkBarController_ isAnimatingToState:BookmarkBar::DETACHED] || | 276 [bookmarkBarController_ isAnimatingToState:BookmarkBar::DETACHED] || |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1018 | 1020 |
1019 [CATransaction commit]; | 1021 [CATransaction commit]; |
1020 hasAdjustedTabStripWhileEnteringAppKitFullscreen_ = YES; | 1022 hasAdjustedTabStripWhileEnteringAppKitFullscreen_ = YES; |
1021 } | 1023 } |
1022 } else { | 1024 } else { |
1023 hasAdjustedTabStripWhileEnteringAppKitFullscreen_ = NO; | 1025 hasAdjustedTabStripWhileEnteringAppKitFullscreen_ = NO; |
1024 } | 1026 } |
1025 } | 1027 } |
1026 | 1028 |
1027 @end // @implementation BrowserWindowController(Private) | 1029 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |