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

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

Issue 2256993002: [Mac] Reworked FullscreenToolbarController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for erikchen Created 4 years, 4 months 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
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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 manager->UpdateAnchorPosition(); 453 manager->UpdateAnchorPosition();
454 } 454 }
455 455
456 - (void)configureFullscreenToolbarController { 456 - (void)configureFullscreenToolbarController {
457 BOOL fullscreenForTab = [self isFullscreenForTabContentOrExtension]; 457 BOOL fullscreenForTab = [self isFullscreenForTabContentOrExtension];
458 BOOL kioskMode = 458 BOOL kioskMode =
459 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); 459 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode);
460 BOOL showDropdown = 460 BOOL showDropdown =
461 !fullscreenForTab && !kioskMode && ([self floatingBarHasFocus]); 461 !fullscreenForTab && !kioskMode && ([self floatingBarHasFocus]);
462 462
463 NSView* contentView = [[self window] contentView];
464 [fullscreenToolbarController_ 463 [fullscreenToolbarController_
465 setupFullscreenToolbarForContentView:contentView 464 setupFullscreenToolbarWithDropdown:showDropdown];
466 showDropdown:showDropdown];
467 } 465 }
468 466
469 - (void)adjustUIForExitingFullscreenAndStopOmniboxSliding { 467 - (void)adjustUIForExitingFullscreenAndStopOmniboxSliding {
470 [fullscreenToolbarController_ exitFullscreenMode]; 468 [fullscreenToolbarController_ exitFullscreenMode];
471 fullscreenToolbarController_.reset(); 469 fullscreenToolbarController_.reset();
472 470
473 // Force the bookmark bar z-order to update. 471 // Force the bookmark bar z-order to update.
474 [[bookmarkBarController_ view] removeFromSuperview]; 472 [[bookmarkBarController_ view] removeFromSuperview];
475 [self layoutSubviews]; 473 [self layoutSubviews];
476 } 474 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 - (void)showFullscreenExitBubbleIfNecessary { 601 - (void)showFullscreenExitBubbleIfNecessary {
604 // This method is called in response to 602 // This method is called in response to
605 // |-updateFullscreenExitBubbleURL:bubbleType:|. If we're in the middle of the 603 // |-updateFullscreenExitBubbleURL:bubbleType:|. If we're in the middle of the
606 // transition into fullscreen (i.e., using the AppKit Fullscreen API), do not 604 // transition into fullscreen (i.e., using the AppKit Fullscreen API), do not
607 // show the bubble because it will cause visual jank 605 // show the bubble because it will cause visual jank
608 // (http://crbug.com/130649). This will be called again as part of 606 // (http://crbug.com/130649). This will be called again as part of
609 // |-windowDidEnterFullScreen:|, so arrange to do that work then instead. 607 // |-windowDidEnterFullScreen:|, so arrange to do that work then instead.
610 if (enteringAppKitFullscreen_) 608 if (enteringAppKitFullscreen_)
611 return; 609 return;
612 610
613 [self hideOverlayIfPossibleWithAnimation:NO delay:NO]; 611 [self hideOverlayIfPossibleWithAnimation:NO];
614 612
615 switch (exclusiveAccessController_->bubble_type()) { 613 switch (exclusiveAccessController_->bubble_type()) {
616 case EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE: 614 case EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE:
617 case EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION: 615 case EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION:
618 // Show no exit instruction bubble on Mac when in Browser Fullscreen. 616 // Show no exit instruction bubble on Mac when in Browser Fullscreen.
619 exclusiveAccessController_->Destroy(); 617 exclusiveAccessController_->Destroy();
620 break; 618 break;
621 619
622 default: 620 default:
623 exclusiveAccessController_->Show(); 621 exclusiveAccessController_->Show();
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 } 846 }
849 847
850 - (void)enableBarVisibilityUpdates { 848 - (void)enableBarVisibilityUpdates {
851 // Early escape if there's nothing to do. 849 // Early escape if there's nothing to do.
852 if (barVisibilityUpdatesEnabled_) 850 if (barVisibilityUpdatesEnabled_)
853 return; 851 return;
854 852
855 barVisibilityUpdatesEnabled_ = YES; 853 barVisibilityUpdatesEnabled_ = YES;
856 854
857 if ([barVisibilityLocks_ count]) 855 if ([barVisibilityLocks_ count])
858 [fullscreenToolbarController_ ensureOverlayShownWithAnimation:NO delay:NO]; 856 [fullscreenToolbarController_ ensureOverlayShownWithAnimation:NO];
859 else 857 else
860 [fullscreenToolbarController_ ensureOverlayHiddenWithAnimation:NO delay:NO]; 858 [fullscreenToolbarController_ ensureOverlayHiddenWithAnimation:NO];
861 } 859 }
862 860
863 - (void)disableBarVisibilityUpdates { 861 - (void)disableBarVisibilityUpdates {
864 // Early escape if there's nothing to do. 862 // Early escape if there's nothing to do.
865 if (!barVisibilityUpdatesEnabled_) 863 if (!barVisibilityUpdatesEnabled_)
866 return; 864 return;
867 865
868 barVisibilityUpdatesEnabled_ = NO; 866 barVisibilityUpdatesEnabled_ = NO;
869 [fullscreenToolbarController_ cancelAnimationAndTimers]; 867 [fullscreenToolbarController_ cancelAnimationAndTimer];
870 } 868 }
871 869
872 - (void)hideOverlayIfPossibleWithAnimation:(BOOL)animation delay:(BOOL)delay { 870 - (void)hideOverlayIfPossibleWithAnimation:(BOOL)animation {
873 if (!barVisibilityUpdatesEnabled_ || [barVisibilityLocks_ count]) 871 if (!barVisibilityUpdatesEnabled_ || [barVisibilityLocks_ count])
874 return; 872 return;
875 [fullscreenToolbarController_ ensureOverlayHiddenWithAnimation:animation 873
876 delay:delay]; 874 [fullscreenToolbarController_ ensureOverlayHiddenWithAnimation:animation];
877 } 875 }
878 876
879 - (CGFloat)toolbarDividerOpacity { 877 - (CGFloat)toolbarDividerOpacity {
880 return [bookmarkBarController_ toolbarDividerOpacity]; 878 return [bookmarkBarController_ toolbarDividerOpacity];
881 } 879 }
882 880
883 - (void)updateInfoBarTipVisibility { 881 - (void)updateInfoBarTipVisibility {
884 // If there's no toolbar then hide the infobar tip. 882 // If there's no toolbar then hide the infobar tip.
885 [infoBarContainerController_ 883 [infoBarContainerController_
886 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; 884 setShouldSuppressTopInfoBarTip:![self hasToolbar]];
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 [infoBarContainerController_ 1002 [infoBarContainerController_
1005 setMaxTopArrowHeight:output.infoBarMaxTopArrowHeight]; 1003 setMaxTopArrowHeight:output.infoBarMaxTopArrowHeight];
1006 [infoBarContainerController_ 1004 [infoBarContainerController_
1007 setInfobarArrowX:[self locationBarBridge]->GetPageInfoBubblePoint().x]; 1005 setInfobarArrowX:[self locationBarBridge]->GetPageInfoBubblePoint().x];
1008 1006
1009 if (!NSIsEmptyRect(output.downloadShelfFrame)) 1007 if (!NSIsEmptyRect(output.downloadShelfFrame))
1010 [[downloadShelfController_ view] setFrame:output.downloadShelfFrame]; 1008 [[downloadShelfController_ view] setFrame:output.downloadShelfFrame];
1011 1009
1012 [self layoutTabContentArea:output.contentAreaFrame]; 1010 [self layoutTabContentArea:output.contentAreaFrame];
1013 1011
1014 if (!NSIsEmptyRect(output.fullscreenBackingBarFrame)) { 1012 if (!NSIsEmptyRect(output.fullscreenBackingBarFrame))
1015 [floatingBarBackingView_ setFrame:output.fullscreenBackingBarFrame]; 1013 [floatingBarBackingView_ setFrame:output.fullscreenBackingBarFrame];
1016 [fullscreenToolbarController_
1017 overlayFrameChanged:output.fullscreenBackingBarFrame];
1018 }
1019 1014
1020 [findBarCocoaController_ 1015 [findBarCocoaController_
1021 positionFindBarViewAtMaxY:output.findBarMaxY 1016 positionFindBarViewAtMaxY:output.findBarMaxY
1022 maxWidth:NSWidth(output.contentAreaFrame)]; 1017 maxWidth:NSWidth(output.contentAreaFrame)];
1023 1018
1024 exclusiveAccessController_->Layout(output.fullscreenExitButtonMaxY); 1019 exclusiveAccessController_->Layout(output.fullscreenExitButtonMaxY);
1025 1020
1026 if (fullscreenLowPowerCoordinator_) { 1021 if (fullscreenLowPowerCoordinator_) {
1027 fullscreenLowPowerCoordinator_->SetLayoutParameters( 1022 fullscreenLowPowerCoordinator_->SetLayoutParameters(
1028 output.toolbarFrame, output.infoBarFrame, output.contentAreaFrame, 1023 output.toolbarFrame, output.infoBarFrame, output.contentAreaFrame,
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 if (fullscreenLowPowerCoordinator_) 1266 if (fullscreenLowPowerCoordinator_)
1272 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); 1267 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false);
1273 } 1268 }
1274 1269
1275 - (void)childWindowsDidChange { 1270 - (void)childWindowsDidChange {
1276 if (fullscreenLowPowerCoordinator_) 1271 if (fullscreenLowPowerCoordinator_)
1277 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); 1272 fullscreenLowPowerCoordinator_->ChildWindowsChanged();
1278 } 1273 }
1279 1274
1280 @end // @implementation BrowserWindowController(Private) 1275 @end // @implementation BrowserWindowController(Private)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.h ('k') | chrome/browser/ui/cocoa/fullscreen_toolbar_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698