| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Emits a histogram entry indicating the Fullscreen style. | 95 // Emits a histogram entry indicating the Fullscreen style. |
| 96 void RecordFullscreenStyle(FullscreenStyle style) { | 96 void RecordFullscreenStyle(FullscreenStyle style) { |
| 97 UMA_HISTOGRAM_ENUMERATION( | 97 UMA_HISTOGRAM_ENUMERATION( |
| 98 "OSX.Fullscreen.Enter.Style", style, FULLSCREEN_STYLE_COUNT); | 98 "OSX.Fullscreen.Enter.Style", style, FULLSCREEN_STYLE_COUNT); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace | 101 } // namespace |
| 102 | 102 |
| 103 @interface NSWindow (NSPrivateApis) |
| 104 // Note: These functions are private, use -[NSObject respondsToSelector:] |
| 105 // before calling them. |
| 106 |
| 107 - (NSWindow*)_windowForToolbar; |
| 108 |
| 109 @end |
| 110 |
| 103 @implementation BrowserWindowController(Private) | 111 @implementation BrowserWindowController(Private) |
| 104 | 112 |
| 105 // Create the tab strip controller. | 113 // Create the tab strip controller. |
| 106 - (void)createTabStripController { | 114 - (void)createTabStripController { |
| 107 DCHECK([overlayableContentsController_ activeContainer]); | 115 DCHECK([overlayableContentsController_ activeContainer]); |
| 108 DCHECK([[overlayableContentsController_ activeContainer] window]); | 116 DCHECK([[overlayableContentsController_ activeContainer] window]); |
| 109 tabStripController_.reset([[TabStripController alloc] | 117 tabStripController_.reset([[TabStripController alloc] |
| 110 initWithView:[self tabStripView] | 118 initWithView:[self tabStripView] |
| 111 switchView:[overlayableContentsController_ activeContainer] | 119 switchView:[overlayableContentsController_ activeContainer] |
| 112 browser:browser_.get() | 120 browser:browser_.get() |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 fullscreenTransition_.reset(); | 713 fullscreenTransition_.reset(); |
| 706 | 714 |
| 707 // In Yosemite, some combination of the titlebar and toolbar always show in | 715 // In Yosemite, some combination of the titlebar and toolbar always show in |
| 708 // full-screen mode. We do not want either to show. Search for the window that | 716 // full-screen mode. We do not want either to show. Search for the window that |
| 709 // contains the views, and hide it. There is no need to ever unhide the view. | 717 // contains the views, and hide it. There is no need to ever unhide the view. |
| 710 // http://crbug.com/380235 | 718 // http://crbug.com/380235 |
| 711 if (base::mac::IsOSYosemiteOrLater()) { | 719 if (base::mac::IsOSYosemiteOrLater()) { |
| 712 for (NSWindow* window in [[NSApplication sharedApplication] windows]) { | 720 for (NSWindow* window in [[NSApplication sharedApplication] windows]) { |
| 713 if ([window | 721 if ([window |
| 714 isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) { | 722 isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) { |
| 715 [[window contentView] setHidden:YES]; | 723 // Hide the toolbar if it is for a FramedBrowserWindow. |
| 724 if ([window respondsToSelector:@selector(_windowForToolbar)]) { |
| 725 if ([[window _windowForToolbar] |
| 726 isKindOfClass:[FramedBrowserWindow class]]) |
| 727 [[window contentView] setHidden:YES]; |
| 728 } |
| 716 } | 729 } |
| 717 } | 730 } |
| 718 } | 731 } |
| 719 | 732 |
| 720 if ([self shouldUseMavericksAppKitFullscreenHack]) { | 733 if ([self shouldUseMavericksAppKitFullscreenHack]) { |
| 721 // Apply a hack to fix the size of the window. This is the last run of the | 734 // Apply a hack to fix the size of the window. This is the last run of the |
| 722 // MessageLoop where the hack will not work, so dispatch the hack to the | 735 // MessageLoop where the hack will not work, so dispatch the hack to the |
| 723 // top of the MessageLoop. | 736 // top of the MessageLoop. |
| 724 base::Callback<void(void)> callback = base::BindBlock(^{ | 737 base::Callback<void(void)> callback = base::BindBlock(^{ |
| 725 if (![self isInAppKitFullscreen]) | 738 if (![self isInAppKitFullscreen]) |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 return browser_->tab_strip_model()->GetActiveWebContents(); | 1205 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 1193 } | 1206 } |
| 1194 | 1207 |
| 1195 - (PermissionBubbleManager*)permissionBubbleManager { | 1208 - (PermissionBubbleManager*)permissionBubbleManager { |
| 1196 if (WebContents* contents = [self webContents]) | 1209 if (WebContents* contents = [self webContents]) |
| 1197 return PermissionBubbleManager::FromWebContents(contents); | 1210 return PermissionBubbleManager::FromWebContents(contents); |
| 1198 return nil; | 1211 return nil; |
| 1199 } | 1212 } |
| 1200 | 1213 |
| 1201 @end // @implementation BrowserWindowController(Private) | 1214 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |