Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 1526533005: Fix for Flash Content Fullscreen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed variable names Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; 448 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
449 [center removeObserver:self 449 [center removeObserver:self
450 name:NSWindowWillCloseNotification 450 name:NSWindowWillCloseNotification
451 object:[notification object]]; 451 object:[notification object]];
452 [self releaseBarVisibilityForOwner:[notification object] 452 [self releaseBarVisibilityForOwner:[notification object]
453 withAnimation:YES 453 withAnimation:YES
454 delay:YES]; 454 delay:YES];
455 } 455 }
456 456
457 - (void)configurePresentationModeController { 457 - (void)configurePresentationModeController {
458 BOOL fullscreen_for_tab = browser_->exclusive_access_manager() 458 BOOL fullscreenForTab = [self isFullscreenForTabContent];
459 ->fullscreen_controller() 459 BOOL kioskMode =
460 ->IsWindowFullscreenForTabOrPending();
461 BOOL kiosk_mode =
462 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); 460 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode);
463 BOOL showDropdown = 461 BOOL showDropdown =
464 !fullscreen_for_tab && !kiosk_mode && ([self floatingBarHasFocus]); 462 !fullscreenForTab && !kioskMode && ([self floatingBarHasFocus]);
465 463
466 PermissionBubbleManager* manager = [self permissionBubbleManager]; 464 PermissionBubbleManager* manager = [self permissionBubbleManager];
467 if (manager && manager->IsBubbleVisible()) { 465 if (manager && manager->IsBubbleVisible()) {
468 NSWindow* bubbleWindow = manager->GetBubbleWindow(); 466 NSWindow* bubbleWindow = manager->GetBubbleWindow();
469 DCHECK(bubbleWindow); 467 DCHECK(bubbleWindow);
470 // A visible permission bubble will force the dropdown to remain 468 // A visible permission bubble will force the dropdown to remain
471 // visible. 469 // visible.
472 [self lockBarVisibilityForOwner:bubbleWindow withAnimation:NO delay:NO]; 470 [self lockBarVisibilityForOwner:bubbleWindow withAnimation:NO delay:NO];
473 showDropdown = YES; 471 showDropdown = YES;
474 // Register to be notified when the permission bubble is closed, to 472 // Register to be notified when the permission bubble is closed, to
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 if (isUsingCustomAnimation_) 708 if (isUsingCustomAnimation_)
711 blockLayoutSubviews_ = YES; 709 blockLayoutSubviews_ = YES;
712 else 710 else
713 [self adjustUIForEnteringFullscreen]; 711 [self adjustUIForEnteringFullscreen];
714 } 712 }
715 713
716 - (void)windowDidEnterFullScreen:(NSNotification*)notification { 714 - (void)windowDidEnterFullScreen:(NSNotification*)notification {
717 blockLayoutSubviews_ = NO; 715 blockLayoutSubviews_ = NO;
718 fullscreenTransition_.reset(); 716 fullscreenTransition_.reset();
719 717
718 if ([self isFullscreenForTabContent]) {
719 NSRect windowFrame = [self window].frame;
720 NSRect contentViewFrame =
721 NSMakeRect(0, 0, windowFrame.size.width, windowFrame.size.height);
722 [self.chromeContentView setFrame:contentViewFrame];
723 }
724
720 // In Yosemite, some combination of the titlebar and toolbar always show in 725 // In Yosemite, some combination of the titlebar and toolbar always show in
721 // full-screen mode. We do not want either to show. Search for the window that 726 // full-screen mode. We do not want either to show. Search for the window that
722 // contains the views, and hide it. There is no need to ever unhide the view. 727 // contains the views, and hide it. There is no need to ever unhide the view.
723 // http://crbug.com/380235 728 // http://crbug.com/380235
724 if (base::mac::IsOSYosemiteOrLater()) { 729 if (base::mac::IsOSYosemiteOrLater()) {
725 for (NSWindow* window in [[NSApplication sharedApplication] windows]) { 730 for (NSWindow* window in [[NSApplication sharedApplication] windows]) {
726 if ([window 731 if ([window
727 isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) { 732 isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) {
728 // Hide the toolbar if it is for a FramedBrowserWindow. 733 // Hide the toolbar if it is for a FramedBrowserWindow.
729 if ([window respondsToSelector:@selector(_windowForToolbar)]) { 734 if ([window respondsToSelector:@selector(_windowForToolbar)]) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 [sheetController unhideSheetForFullscreenTransition]; 855 [sheetController unhideSheetForFullscreenTransition];
851 } 856 }
852 857
853 - (void)adjustUIForExitingFullscreen { 858 - (void)adjustUIForExitingFullscreen {
854 [self destroyFullscreenExitBubbleIfNecessary]; 859 [self destroyFullscreenExitBubbleIfNecessary];
855 [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; 860 [self adjustUIForExitingFullscreenAndStopOmniboxSliding];
856 } 861 }
857 862
858 - (void)adjustUIForEnteringFullscreen { 863 - (void)adjustUIForEnteringFullscreen {
859 fullscreen_mac::SlidingStyle style; 864 fullscreen_mac::SlidingStyle style;
860 if (browser_->exclusive_access_manager() 865 if ([self isFullscreenForTabContent]) {
861 ->fullscreen_controller()
862 ->IsWindowFullscreenForTabOrPending()) {
863 style = fullscreen_mac::OMNIBOX_TABS_NONE; 866 style = fullscreen_mac::OMNIBOX_TABS_NONE;
864 } else if (enteringPresentationMode_ || [self shouldHideFullscreenToolbar]) { 867 } else if (enteringPresentationMode_ || [self shouldHideFullscreenToolbar]) {
865 style = fullscreen_mac::OMNIBOX_TABS_HIDDEN; 868 style = fullscreen_mac::OMNIBOX_TABS_HIDDEN;
866 } else { 869 } else {
867 style = fullscreen_mac::OMNIBOX_TABS_PRESENT; 870 style = fullscreen_mac::OMNIBOX_TABS_PRESENT;
868 } 871 }
869 872
870 [self adjustUIForSlidingFullscreenStyle:style]; 873 [self adjustUIForSlidingFullscreenStyle:style];
871 } 874 }
872 875
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 - (BOOL)shouldUseCustomAppKitFullscreenTransition:(BOOL)enterFullScreen { 1165 - (BOOL)shouldUseCustomAppKitFullscreenTransition:(BOOL)enterFullScreen {
1163 // Custom fullscreen transitions should only be available in OSX 10.10+. 1166 // Custom fullscreen transitions should only be available in OSX 10.10+.
1164 if (base::mac::IsOSMountainLionOrEarlier()) 1167 if (base::mac::IsOSMountainLionOrEarlier())
1165 return NO; 1168 return NO;
1166 1169
1167 // Disable the custom exit animation in OSX 10.9: 1170 // Disable the custom exit animation in OSX 10.9:
1168 // https://code.google.com/p/chromium/issues/detail?id=526327#c3. 1171 // https://code.google.com/p/chromium/issues/detail?id=526327#c3.
1169 if (base::mac::IsOSMavericks() && !enterFullScreen) 1172 if (base::mac::IsOSMavericks() && !enterFullScreen)
1170 return NO; 1173 return NO;
1171 1174
1175 // Temporary disable custom enter animation since it currently breaks the
1176 // fullscreen Flash content.
1177 // TODO(spqchan): Fix the custom animation to enter fullscreen so that it
1178 // will work with Flash content.
1179 if (enterFullScreen && [self isFullscreenForTabContent])
1180 return NO;
1181
1172 NSView* root = [[self.window contentView] superview]; 1182 NSView* root = [[self.window contentView] superview];
1173 if (!root.layer) 1183 if (!root.layer)
1174 return NO; 1184 return NO;
1175 1185
1176 // AppKit on OSX 10.9 has a bug for applications linked against OSX 10.8 SDK 1186 // AppKit on OSX 10.9 has a bug for applications linked against OSX 10.8 SDK
1177 // and earlier. Under specific circumstances, it prevents the custom AppKit 1187 // and earlier. Under specific circumstances, it prevents the custom AppKit
1178 // transition from working well. See http://crbug.com/396980 for more 1188 // transition from working well. See http://crbug.com/396980 for more
1179 // details. 1189 // details.
1180 if ([[self class] systemSettingsRequireMavericksAppKitFullscreenHack] && 1190 if ([[self class] systemSettingsRequireMavericksAppKitFullscreenHack] &&
1181 ![[[self window] screen] isEqual:[[NSScreen screens] firstObject]]) { 1191 ![[[self window] screen] isEqual:[[NSScreen screens] firstObject]]) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 - (WebContents*)webContents { 1260 - (WebContents*)webContents {
1251 return browser_->tab_strip_model()->GetActiveWebContents(); 1261 return browser_->tab_strip_model()->GetActiveWebContents();
1252 } 1262 }
1253 1263
1254 - (PermissionBubbleManager*)permissionBubbleManager { 1264 - (PermissionBubbleManager*)permissionBubbleManager {
1255 if (WebContents* contents = [self webContents]) 1265 if (WebContents* contents = [self webContents])
1256 return PermissionBubbleManager::FromWebContents(contents); 1266 return PermissionBubbleManager::FromWebContents(contents);
1257 return nil; 1267 return nil;
1258 } 1268 }
1259 1269
1270 - (BOOL)isFullscreenForTabContent {
1271 return browser_->exclusive_access_manager()
1272 ->fullscreen_controller()
1273 ->IsWindowFullscreenForTabOrPending();
1274 }
1275
1260 @end // @implementation BrowserWindowController(Private) 1276 @end // @implementation BrowserWindowController(Private)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698