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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 void RecordFullscreenStyle(FullscreenStyle style) { | 99 void RecordFullscreenStyle(FullscreenStyle style) { |
100 UMA_HISTOGRAM_ENUMERATION( | 100 UMA_HISTOGRAM_ENUMERATION( |
101 "OSX.Fullscreen.Enter.Style", style, FULLSCREEN_STYLE_COUNT); | 101 "OSX.Fullscreen.Enter.Style", style, FULLSCREEN_STYLE_COUNT); |
102 } | 102 } |
103 | 103 |
104 } // namespace | 104 } // namespace |
105 | 105 |
106 @interface NSWindow (NSPrivateApis) | 106 @interface NSWindow (NSPrivateApis) |
107 // Note: These functions are private, use -[NSObject respondsToSelector:] | 107 // Note: These functions are private, use -[NSObject respondsToSelector:] |
108 // before calling them. | 108 // before calling them. |
109 | |
110 - (NSWindow*)_windowForToolbar; | 109 - (NSWindow*)_windowForToolbar; |
111 | |
112 @end | 110 @end |
113 | 111 |
114 @implementation BrowserWindowController(Private) | 112 @implementation BrowserWindowController(Private) |
115 | 113 |
116 // Create the tab strip controller. | 114 // Create the tab strip controller. |
117 - (void)createTabStripController { | 115 - (void)createTabStripController { |
118 DCHECK([overlayableContentsController_ activeContainer]); | 116 DCHECK([overlayableContentsController_ activeContainer]); |
119 DCHECK([[overlayableContentsController_ activeContainer] window]); | 117 DCHECK([[overlayableContentsController_ activeContainer] window]); |
120 tabStripController_.reset([[TabStripController alloc] | 118 tabStripController_.reset([[TabStripController alloc] |
121 initWithView:[self tabStripView] | 119 initWithView:[self tabStripView] |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 NSPoint iconBottom = locationBarView->GetPageInfoBubblePoint(); | 904 NSPoint iconBottom = locationBarView->GetPageInfoBubblePoint(); |
907 | 905 |
908 // The toolbar, in window coordinates. | 906 // The toolbar, in window coordinates. |
909 NSView* toolbar = [toolbarController_ view]; | 907 NSView* toolbar = [toolbarController_ view]; |
910 CGFloat toolbarY = NSMinY([toolbar convertRect:[toolbar bounds] toView:nil]); | 908 CGFloat toolbarY = NSMinY([toolbar convertRect:[toolbar bounds] toView:nil]); |
911 | 909 |
912 return iconBottom.y - toolbarY; | 910 return iconBottom.y - toolbarY; |
913 } | 911 } |
914 | 912 |
915 - (void)enterAppKitFullscreen { | 913 - (void)enterAppKitFullscreen { |
916 DCHECK(base::mac::IsOSLionOrLater()); | |
917 if (FramedBrowserWindow* framedBrowserWindow = | 914 if (FramedBrowserWindow* framedBrowserWindow = |
918 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { | 915 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { |
919 [framedBrowserWindow toggleSystemFullScreen]; | 916 [framedBrowserWindow toggleSystemFullScreen]; |
920 } | 917 } |
921 } | 918 } |
922 | 919 |
923 - (void)exitAppKitFullscreen { | 920 - (void)exitAppKitFullscreen { |
924 DCHECK(base::mac::IsOSLionOrLater()); | |
925 if (FramedBrowserWindow* framedBrowserWindow = | 921 if (FramedBrowserWindow* framedBrowserWindow = |
926 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { | 922 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { |
927 [framedBrowserWindow toggleSystemFullScreen]; | 923 [framedBrowserWindow toggleSystemFullScreen]; |
928 } | 924 } |
929 } | 925 } |
930 | 926 |
931 - (NSRect)fullscreenButtonFrame { | 927 - (NSRect)fullscreenButtonFrame { |
932 NSButton* fullscreenButton = | 928 NSButton* fullscreenButton = |
933 [[self window] standardWindowButton:NSWindowFullScreenButton]; | 929 [[self window] standardWindowButton:NSWindowFullScreenButton]; |
934 if (!fullscreenButton) | 930 if (!fullscreenButton) |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 } | 1242 } |
1247 | 1243 |
1248 - (BOOL)isFullscreenForTabContentOrExtension { | 1244 - (BOOL)isFullscreenForTabContentOrExtension { |
1249 FullscreenController* controller = | 1245 FullscreenController* controller = |
1250 browser_->exclusive_access_manager()->fullscreen_controller(); | 1246 browser_->exclusive_access_manager()->fullscreen_controller(); |
1251 return controller->IsWindowFullscreenForTabOrPending() || | 1247 return controller->IsWindowFullscreenForTabOrPending() || |
1252 controller->IsExtensionFullscreenOrPending(); | 1248 controller->IsExtensionFullscreenOrPending(); |
1253 } | 1249 } |
1254 | 1250 |
1255 @end // @implementation BrowserWindowController(Private) | 1251 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |