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/browser_window_controller_private.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #import "base/memory/scoped_nsobject.h" | 8 #import "base/memory/scoped_nsobject.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 // Set indentation. | 299 // Set indentation. |
300 [tabStripController_ setIndentForControls:(fullscreen ? 0 : | 300 [tabStripController_ setIndentForControls:(fullscreen ? 0 : |
301 [[tabStripController_ class] defaultIndentForControls])]; | 301 [[tabStripController_ class] defaultIndentForControls])]; |
302 | 302 |
303 // TODO(viettrungluu): Seems kind of bad -- shouldn't |-layoutSubviews| do | 303 // TODO(viettrungluu): Seems kind of bad -- shouldn't |-layoutSubviews| do |
304 // this? Moreover, |-layoutTabs| will try to animate.... | 304 // this? Moreover, |-layoutTabs| will try to animate.... |
305 [tabStripController_ layoutTabs]; | 305 [tabStripController_ layoutTabs]; |
306 | 306 |
307 // Now lay out incognito badge together with the tab strip. | 307 // Now lay out incognito badge together with the tab strip. |
308 if (avatarButton_.get()) { | 308 if (avatarButton_.get()) { |
309 // Avoid the full-screen button. | |
310 CGFloat extraPadding = 0; | |
311 if ([[self window] respondsToSelector:@selector(toggleFullScreen:)]) { | |
312 NSButton* fullscreenButton = | |
313 [[self window] standardWindowButton:NSWindowFullScreenButton]; | |
314 if (fullscreenButton) | |
315 extraPadding += [fullscreenButton frame].size.width; | |
316 } | |
317 | |
318 // Set the size of the avatar to be the (height of the tabstrip) - (padding) | 309 // Set the size of the avatar to be the (height of the tabstrip) - (padding) |
319 // to let large icons fit. | 310 // to let large icons fit. |
320 CGFloat sizeSquare = tabStripHeight - 5.0; | 311 CGFloat sizeSquare = tabStripHeight - 5.0; |
321 [avatarButton_ setFrameSize:NSMakeSize(sizeSquare, sizeSquare)]; | 312 [avatarButton_ setFrameSize:NSMakeSize(sizeSquare, sizeSquare)]; |
322 | 313 |
323 // Actually place the badge *above* |maxY|, by +2 to miss the divider. | 314 // Actually place the badge *above* |maxY|, by +2 to miss the divider. |
324 NSPoint origin = NSMakePoint(width - NSWidth([avatarButton_ frame]) - | 315 NSPoint origin = NSMakePoint(width - NSWidth([avatarButton_ frame]) - |
325 kIncognitoBadgeOffset - extraPadding, | 316 kIncognitoBadgeOffset, |
326 maxY + 2); | 317 maxY + 2); |
327 [avatarButton_ setFrameOrigin:origin]; | 318 [avatarButton_ setFrameOrigin:origin]; |
328 [avatarButton_ setHidden:NO]; // Make sure it's shown. | 319 [avatarButton_ setHidden:NO]; // Make sure it's shown. |
329 } | 320 } |
330 | 321 |
331 return maxY; | 322 return maxY; |
332 } | 323 } |
333 | 324 |
334 - (CGFloat)layoutToolbarAtMinX:(CGFloat)minX | 325 - (CGFloat)layoutToolbarAtMinX:(CGFloat)minX |
335 maxY:(CGFloat)maxY | 326 maxY:(CGFloat)maxY |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
541 | 532 |
542 - (void)disableBarVisibilityUpdates { | 533 - (void)disableBarVisibilityUpdates { |
543 // Early escape if there's nothing to do. | 534 // Early escape if there's nothing to do. |
544 if (!barVisibilityUpdatesEnabled_) | 535 if (!barVisibilityUpdatesEnabled_) |
545 return; | 536 return; |
546 | 537 |
547 barVisibilityUpdatesEnabled_ = NO; | 538 barVisibilityUpdatesEnabled_ = NO; |
548 [fullscreenController_ cancelAnimationAndTimers]; | 539 [fullscreenController_ cancelAnimationAndTimers]; |
549 } | 540 } |
550 | 541 |
551 - (void)setUpOSFullScreenButton { | 542 - (void)setUpOSFullScreenButton { |
Mark Mentovai
2011/07/15 16:28:09
Are you sure you don’t want to dump this entirely
| |
552 NSWindow* window = [self window]; | 543 // TOOD(rsesek): Properly implement Lion fullscreen <http://crbug.com/74065>. |
553 if ([window respondsToSelector:@selector(toggleFullScreen:)]) { | |
554 NSWindowCollectionBehavior behavior = [window collectionBehavior]; | |
555 behavior |= NSWindowCollectionBehaviorFullScreenPrimary; | |
556 [window setCollectionBehavior:behavior]; | |
557 | |
558 NSButton* fullscreenButton = | |
559 [window standardWindowButton:NSWindowFullScreenButton]; | |
560 [fullscreenButton setAction:@selector(enterFullscreen:)]; | |
561 [fullscreenButton setTarget:self]; | |
562 } | |
563 } | 544 } |
564 | 545 |
565 @end // @implementation BrowserWindowController(Private) | 546 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |