Chromium Code Reviews| 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")]) { |
| 723 // Check if the window that the toolbar belongs to is a Chrome App | |
| 724 // window. If it is, then don't hide it. | |
| 725 if ([window respondsToSelector:@selector(_windowForToolbar)]) { | |
| 726 NSWindow* windowForToolbar = [window _windowForToolbar]; | |
| 727 SEL selector = @selector(shouldHideFullscreenToolbar); | |
|
erikchen
2015/11/10 08:17:22
If you're just trying to skip the Chrome App windo
spqchan
2015/11/10 17:14:28
Former: I did that earlier in Patch 2, please see
| |
| 728 if ([windowForToolbar respondsToSelector:selector] && | |
| 729 ![windowForToolbar performSelector:selector]) | |
| 730 continue; | |
| 731 } | |
| 715 [[window contentView] setHidden:YES]; | 732 [[window contentView] setHidden:YES]; |
| 716 } | 733 } |
| 717 } | 734 } |
| 718 } | 735 } |
| 719 | 736 |
| 720 if ([self shouldUseMavericksAppKitFullscreenHack]) { | 737 if ([self shouldUseMavericksAppKitFullscreenHack]) { |
| 721 // Apply a hack to fix the size of the window. This is the last run of the | 738 // 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 | 739 // MessageLoop where the hack will not work, so dispatch the hack to the |
| 723 // top of the MessageLoop. | 740 // top of the MessageLoop. |
| 724 base::Callback<void(void)> callback = base::BindBlock(^{ | 741 base::Callback<void(void)> callback = base::BindBlock(^{ |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1192 return browser_->tab_strip_model()->GetActiveWebContents(); | 1209 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 1193 } | 1210 } |
| 1194 | 1211 |
| 1195 - (PermissionBubbleManager*)permissionBubbleManager { | 1212 - (PermissionBubbleManager*)permissionBubbleManager { |
| 1196 if (WebContents* contents = [self webContents]) | 1213 if (WebContents* contents = [self webContents]) |
| 1197 return PermissionBubbleManager::FromWebContents(contents); | 1214 return PermissionBubbleManager::FromWebContents(contents); |
| 1198 return nil; | 1215 return nil; |
| 1199 } | 1216 } |
| 1200 | 1217 |
| 1201 @end // @implementation BrowserWindowController(Private) | 1218 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |