| 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 #import "base/auto_reset.h" | 9 #import "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 NSView* toolbar = [toolbarController_ view]; | 901 NSView* toolbar = [toolbarController_ view]; |
| 902 CGFloat toolbarY = NSMinY([toolbar convertRect:[toolbar bounds] toView:nil]); | 902 CGFloat toolbarY = NSMinY([toolbar convertRect:[toolbar bounds] toView:nil]); |
| 903 | 903 |
| 904 return iconBottom.y - toolbarY; | 904 return iconBottom.y - toolbarY; |
| 905 } | 905 } |
| 906 | 906 |
| 907 - (void)enterAppKitFullscreen { | 907 - (void)enterAppKitFullscreen { |
| 908 DCHECK(base::mac::IsOSLionOrLater()); | 908 DCHECK(base::mac::IsOSLionOrLater()); |
| 909 if (FramedBrowserWindow* framedBrowserWindow = | 909 if (FramedBrowserWindow* framedBrowserWindow = |
| 910 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { | 910 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { |
| 911 if (WebContents* contents = [self webContents]) { |
| 912 if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) { |
| 913 detachedModeWindow_.reset(rwhv->CreateDetachedModeWindow()); |
| 914 } |
| 915 } |
| 911 [framedBrowserWindow toggleSystemFullScreen]; | 916 [framedBrowserWindow toggleSystemFullScreen]; |
| 912 } | 917 } |
| 913 } | 918 } |
| 914 | 919 |
| 915 - (void)exitAppKitFullscreen { | 920 - (void)exitAppKitFullscreen { |
| 916 DCHECK(base::mac::IsOSLionOrLater()); | 921 DCHECK(base::mac::IsOSLionOrLater()); |
| 917 if (FramedBrowserWindow* framedBrowserWindow = | 922 if (FramedBrowserWindow* framedBrowserWindow = |
| 918 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { | 923 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { |
| 919 [framedBrowserWindow toggleSystemFullScreen]; | 924 [framedBrowserWindow toggleSystemFullScreen]; |
| 920 } | 925 } |
| 926 [detachedModeWindow_ close]; |
| 927 detachedModeWindow_.reset(); |
| 921 } | 928 } |
| 922 | 929 |
| 923 - (NSRect)fullscreenButtonFrame { | 930 - (NSRect)fullscreenButtonFrame { |
| 924 // NSWindowFullScreenButton is 10.7+ and results in log spam on 10.6 if used. | 931 // NSWindowFullScreenButton is 10.7+ and results in log spam on 10.6 if used. |
| 925 if (base::mac::IsOSSnowLeopard()) | 932 if (base::mac::IsOSSnowLeopard()) |
| 926 return NSZeroRect; | 933 return NSZeroRect; |
| 927 | 934 |
| 928 NSButton* fullscreenButton = | 935 NSButton* fullscreenButton = |
| 929 [[self window] standardWindowButton:NSWindowFullScreenButton]; | 936 [[self window] standardWindowButton:NSWindowFullScreenButton]; |
| 930 if (!fullscreenButton) | 937 if (!fullscreenButton) |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 DCHECK([window isEqual:self.window]); | 1189 DCHECK([window isEqual:self.window]); |
| 1183 | 1190 |
| 1184 if (![self shouldUseCustomAppKitFullscreenTransition:YES]) | 1191 if (![self shouldUseCustomAppKitFullscreenTransition:YES]) |
| 1185 return nil; | 1192 return nil; |
| 1186 | 1193 |
| 1187 fullscreenTransition_.reset( | 1194 fullscreenTransition_.reset( |
| 1188 [[BrowserWindowFullscreenTransition alloc] initEnterWithController:self]); | 1195 [[BrowserWindowFullscreenTransition alloc] initEnterWithController:self]); |
| 1189 | 1196 |
| 1190 NSArray* customWindows = | 1197 NSArray* customWindows = |
| 1191 [fullscreenTransition_ customWindowsForFullScreenTransition]; | 1198 [fullscreenTransition_ customWindowsForFullScreenTransition]; |
| 1199 |
| 1200 if (detachedModeWindow_) |
| 1201 customWindows = [customWindows arrayByAddingObject:detachedModeWindow_]; |
| 1202 |
| 1192 isUsingCustomAnimation_ = customWindows != nil; | 1203 isUsingCustomAnimation_ = customWindows != nil; |
| 1193 return customWindows; | 1204 return customWindows; |
| 1194 } | 1205 } |
| 1195 | 1206 |
| 1196 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { | 1207 - (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window { |
| 1197 DCHECK([window isEqual:self.window]); | 1208 DCHECK([window isEqual:self.window]); |
| 1198 | 1209 |
| 1199 if (![self shouldUseCustomAppKitFullscreenTransition:NO]) | 1210 if (![self shouldUseCustomAppKitFullscreenTransition:NO]) |
| 1200 return nil; | 1211 return nil; |
| 1201 | 1212 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 return nil; | 1252 return nil; |
| 1242 } | 1253 } |
| 1243 | 1254 |
| 1244 - (BOOL)isFullscreenForTabContent { | 1255 - (BOOL)isFullscreenForTabContent { |
| 1245 return browser_->exclusive_access_manager() | 1256 return browser_->exclusive_access_manager() |
| 1246 ->fullscreen_controller() | 1257 ->fullscreen_controller() |
| 1247 ->IsWindowFullscreenForTabOrPending(); | 1258 ->IsWindowFullscreenForTabOrPending(); |
| 1248 } | 1259 } |
| 1249 | 1260 |
| 1250 @end // @implementation BrowserWindowController(Private) | 1261 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |