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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // Set indentation. | 297 // Set indentation. |
298 [tabStripController_ setIndentForControls:(fullscreen ? 0 : | 298 [tabStripController_ setIndentForControls:(fullscreen ? 0 : |
299 [[tabStripController_ class] defaultIndentForControls])]; | 299 [[tabStripController_ class] defaultIndentForControls])]; |
300 | 300 |
301 // TODO(viettrungluu): Seems kind of bad -- shouldn't |-layoutSubviews| do | 301 // TODO(viettrungluu): Seems kind of bad -- shouldn't |-layoutSubviews| do |
302 // this? Moreover, |-layoutTabs| will try to animate.... | 302 // this? Moreover, |-layoutTabs| will try to animate.... |
303 [tabStripController_ layoutTabs]; | 303 [tabStripController_ layoutTabs]; |
304 | 304 |
305 // Now lay out incognito badge together with the tab strip. | 305 // Now lay out incognito badge together with the tab strip. |
306 if (incognitoBadge_.get()) { | 306 if (incognitoBadge_.get()) { |
307 // Avoid the full-screen button. | |
308 CGFloat extraPadding = 0; | |
309 if ([[self window] respondsToSelector:@selector(toggleFullScreen:)]) { | |
310 NSButton* fullscreenButton = | |
311 [[self window] standardWindowButton:NSWindowFullScreenButton]; | |
312 if (fullscreenButton) | |
313 extraPadding += [fullscreenButton frame].size.width; | |
314 } | |
315 | |
316 // Actually place the badge *above* |maxY|, by +2 to miss the divider. | 307 // Actually place the badge *above* |maxY|, by +2 to miss the divider. |
317 NSPoint origin = NSMakePoint(width - NSWidth([incognitoBadge_ frame]) - | 308 NSPoint origin = NSMakePoint(width - NSWidth([incognitoBadge_ frame]) - |
318 kIncognitoBadgeOffset - extraPadding, | 309 kIncognitoBadgeOffset, |
319 maxY + 2); | 310 maxY + 2); |
320 [incognitoBadge_ setFrameOrigin:origin]; | 311 [incognitoBadge_ setFrameOrigin:origin]; |
321 [incognitoBadge_ setHidden:NO]; // Make sure it's shown. | 312 [incognitoBadge_ setHidden:NO]; // Make sure it's shown. |
322 } | 313 } |
323 | 314 |
324 return maxY; | 315 return maxY; |
325 } | 316 } |
326 | 317 |
327 - (CGFloat)layoutToolbarAtMinX:(CGFloat)minX | 318 - (CGFloat)layoutToolbarAtMinX:(CGFloat)minX |
328 maxY:(CGFloat)maxY | 319 maxY:(CGFloat)maxY |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 - (void)disableBarVisibilityUpdates { | 527 - (void)disableBarVisibilityUpdates { |
537 // Early escape if there's nothing to do. | 528 // Early escape if there's nothing to do. |
538 if (!barVisibilityUpdatesEnabled_) | 529 if (!barVisibilityUpdatesEnabled_) |
539 return; | 530 return; |
540 | 531 |
541 barVisibilityUpdatesEnabled_ = NO; | 532 barVisibilityUpdatesEnabled_ = NO; |
542 [fullscreenController_ cancelAnimationAndTimers]; | 533 [fullscreenController_ cancelAnimationAndTimers]; |
543 } | 534 } |
544 | 535 |
545 - (void)setUpOSFullScreenButton { | 536 - (void)setUpOSFullScreenButton { |
546 NSWindow* window = [self window]; | 537 // TOOD(rsesek): Properly implement Lion fullscreen <http://crbug.com/74065>. |
547 if ([window respondsToSelector:@selector(toggleFullScreen:)]) { | |
548 NSWindowCollectionBehavior behavior = [window collectionBehavior]; | |
549 behavior |= NSWindowCollectionBehaviorFullScreenPrimary; | |
550 [window setCollectionBehavior:behavior]; | |
551 | |
552 NSButton* fullscreenButton = | |
553 [window standardWindowButton:NSWindowFullScreenButton]; | |
554 [fullscreenButton setAction:@selector(enterFullscreen:)]; | |
555 [fullscreenButton setTarget:self]; | |
556 } | |
557 } | 538 } |
558 | 539 |
559 @end // @implementation BrowserWindowController(Private) | 540 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |