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 17 matching lines...) Expand all Loading... |
28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
29 #include "content/browser/renderer_host/render_widget_host_view.h" | 29 #include "content/browser/renderer_host/render_widget_host_view.h" |
30 #include "content/browser/tab_contents/tab_contents.h" | 30 #include "content/browser/tab_contents/tab_contents.h" |
31 #include "content/browser/tab_contents/tab_contents_view.h" | 31 #include "content/browser/tab_contents/tab_contents_view.h" |
32 | 32 |
33 // Provide the forward-declarations of new 10.7 SDK symbols so they can be | 33 // Provide the forward-declarations of new 10.7 SDK symbols so they can be |
34 // called when building with the 10.5 SDK. | 34 // called when building with the 10.5 SDK. |
35 #if !defined(MAC_OS_X_VERSION_10_7) || \ | 35 #if !defined(MAC_OS_X_VERSION_10_7) || \ |
36 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | 36 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
37 | 37 |
38 @interface NSWindow (LionSDKDeclarations) | |
39 - (void)toggleFullScreen:(id)sender; | |
40 @end | |
41 | |
42 enum { | |
43 NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7, | |
44 NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8 | |
45 }; | |
46 | |
47 enum { | 38 enum { |
48 NSWindowFullScreenButton = 7 | 39 NSWindowFullScreenButton = 7 |
49 }; | 40 }; |
50 | 41 |
51 #endif // MAC_OS_X_VERSION_10_7 | 42 #endif // MAC_OS_X_VERSION_10_7 |
52 | 43 |
53 namespace { | 44 namespace { |
54 | 45 |
55 // Space between the incognito badge and the right edge of the window. | 46 // Space between the incognito badge and the right edge of the window. |
56 const CGFloat kIncognitoBadgeOffset = 4; | 47 const CGFloat kIncognitoBadgeOffset = 4; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 (floor((1 - floatingBarShownFraction_) * floatingBarHeight) - | 183 (floor((1 - floatingBarShownFraction_) * floatingBarHeight) - |
193 [fullscreenController_ floatingBarVerticalOffset]) : 0; | 184 [fullscreenController_ floatingBarVerticalOffset]) : 0; |
194 CGFloat maxY = NSMaxY(contentBounds) + yOffset; | 185 CGFloat maxY = NSMaxY(contentBounds) + yOffset; |
195 CGFloat startMaxY = maxY; | 186 CGFloat startMaxY = maxY; |
196 | 187 |
197 if ([self hasTabStrip] && ![self useVerticalTabs]) { | 188 if ([self hasTabStrip] && ![self useVerticalTabs]) { |
198 // If we need to lay out the top tab strip, replace |maxY| and |startMaxY| | 189 // If we need to lay out the top tab strip, replace |maxY| and |startMaxY| |
199 // with higher values, and then lay out the tab strip. | 190 // with higher values, and then lay out the tab strip. |
200 NSRect windowFrame = [contentView convertRect:[window frame] fromView:nil]; | 191 NSRect windowFrame = [contentView convertRect:[window frame] fromView:nil]; |
201 startMaxY = maxY = NSHeight(windowFrame) + yOffset; | 192 startMaxY = maxY = NSHeight(windowFrame) + yOffset; |
202 maxY = [self layoutTabStripAtMaxY:maxY width:width fullscreen:isFullscreen]; | 193 maxY = [self layoutTabStripAtMaxY:maxY |
| 194 width:width |
| 195 fullscreen:isFullscreen || [self isLionFullScreen]]; |
203 } | 196 } |
204 | 197 |
205 // Sanity-check |maxY|. | 198 // Sanity-check |maxY|. |
206 DCHECK_GE(maxY, minY); | 199 DCHECK_GE(maxY, minY); |
207 DCHECK_LE(maxY, NSMaxY(contentBounds) + yOffset); | 200 DCHECK_LE(maxY, NSMaxY(contentBounds) + yOffset); |
208 | 201 |
209 // The base class already positions the side tab strip on the left side | 202 // The base class already positions the side tab strip on the left side |
210 // of the window's content area and sizes it to take the entire vertical | 203 // of the window's content area and sizes it to take the entire vertical |
211 // height. All that's needed here is to push everything over to the right, | 204 // height. All that's needed here is to push everything over to the right, |
212 // if necessary. | 205 // if necessary. |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 | 534 |
542 - (void)disableBarVisibilityUpdates { | 535 - (void)disableBarVisibilityUpdates { |
543 // Early escape if there's nothing to do. | 536 // Early escape if there's nothing to do. |
544 if (!barVisibilityUpdatesEnabled_) | 537 if (!barVisibilityUpdatesEnabled_) |
545 return; | 538 return; |
546 | 539 |
547 barVisibilityUpdatesEnabled_ = NO; | 540 barVisibilityUpdatesEnabled_ = NO; |
548 [fullscreenController_ cancelAnimationAndTimers]; | 541 [fullscreenController_ cancelAnimationAndTimers]; |
549 } | 542 } |
550 | 543 |
551 - (void)setUpOSFullScreenButton { | |
552 NSWindow* window = [self window]; | |
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 } | |
564 | |
565 @end // @implementation BrowserWindowController(Private) | 544 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |