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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 fullscreen:(BOOL)fullscreen { | 326 fullscreen:(BOOL)fullscreen { |
327 // Nothing to do if no tab strip. | 327 // Nothing to do if no tab strip. |
328 if (![self hasTabStrip]) | 328 if (![self hasTabStrip]) |
329 return maxY; | 329 return maxY; |
330 | 330 |
331 NSView* tabStripView = [self tabStripView]; | 331 NSView* tabStripView = [self tabStripView]; |
332 CGFloat tabStripHeight = NSHeight([tabStripView frame]); | 332 CGFloat tabStripHeight = NSHeight([tabStripView frame]); |
333 maxY -= tabStripHeight; | 333 maxY -= tabStripHeight; |
334 [tabStripView setFrame:NSMakeRect(0, maxY, width, tabStripHeight)]; | 334 [tabStripView setFrame:NSMakeRect(0, maxY, width, tabStripHeight)]; |
335 | 335 |
| 336 // In Yosemite fullscreen, manually add the fullscreen controls to the tab |
| 337 // strip. |
| 338 BOOL addControlsInFullscreen = |
| 339 [self isInAppKitFullscreen] && base::mac::IsOSYosemiteOrLater(); |
| 340 |
336 // Set left indentation based on fullscreen mode status. | 341 // Set left indentation based on fullscreen mode status. |
337 [tabStripController_ setLeftIndentForControls:(fullscreen ? 0 : | 342 CGFloat leftIndent = 0; |
338 [[tabStripController_ class] defaultLeftIndentForControls])]; | 343 if (!fullscreen || addControlsInFullscreen) |
| 344 leftIndent = [[tabStripController_ class] defaultLeftIndentForControls]; |
| 345 [tabStripController_ setLeftIndentForControls:leftIndent]; |
| 346 |
| 347 if (addControlsInFullscreen) |
| 348 [tabStripController_ addWindowControls]; |
| 349 else |
| 350 [tabStripController_ removeWindowControls]; |
339 | 351 |
340 // Lay out the icognito/avatar badge because calculating the indentation on | 352 // Lay out the icognito/avatar badge because calculating the indentation on |
341 // the right depends on it. | 353 // the right depends on it. |
342 NSView* avatarButton = [avatarButtonController_ view]; | 354 NSView* avatarButton = [avatarButtonController_ view]; |
343 if ([self shouldShowAvatar]) { | 355 if ([self shouldShowAvatar]) { |
344 CGFloat badgeXOffset = -kAvatarRightOffset; | 356 CGFloat badgeXOffset = -kAvatarRightOffset; |
345 CGFloat badgeYOffset = 0; | 357 CGFloat badgeYOffset = 0; |
346 CGFloat buttonHeight = NSHeight([avatarButton frame]); | 358 CGFloat buttonHeight = NSHeight([avatarButton frame]); |
347 | 359 |
348 if ([self shouldUseNewAvatarButton]) { | 360 if ([self shouldUseNewAvatarButton]) { |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 | 1179 |
1168 - (void)exitAppKitFullscreen { | 1180 - (void)exitAppKitFullscreen { |
1169 DCHECK(base::mac::IsOSLionOrLater()); | 1181 DCHECK(base::mac::IsOSLionOrLater()); |
1170 if (FramedBrowserWindow* framedBrowserWindow = | 1182 if (FramedBrowserWindow* framedBrowserWindow = |
1171 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { | 1183 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { |
1172 [framedBrowserWindow toggleSystemFullScreen]; | 1184 [framedBrowserWindow toggleSystemFullScreen]; |
1173 } | 1185 } |
1174 } | 1186 } |
1175 | 1187 |
1176 @end // @implementation BrowserWindowController(Private) | 1188 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |