| 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 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 ([self hasTabStrip] || [self hasToolbar] || [self hasLocationBar])) { | 786 ([self hasTabStrip] || [self hasToolbar] || [self hasLocationBar])) { |
| 787 floatingBarBackingView_.reset( | 787 floatingBarBackingView_.reset( |
| 788 [[FloatingBarBackingView alloc] initWithFrame:NSZeroRect]); | 788 [[FloatingBarBackingView alloc] initWithFrame:NSZeroRect]); |
| 789 [floatingBarBackingView_ setAutoresizingMask:(NSViewWidthSizable | | 789 [floatingBarBackingView_ setAutoresizingMask:(NSViewWidthSizable | |
| 790 NSViewMinYMargin)]; | 790 NSViewMinYMargin)]; |
| 791 } | 791 } |
| 792 | 792 |
| 793 // Force the bookmark bar z-order to update. | 793 // Force the bookmark bar z-order to update. |
| 794 [[bookmarkBarController_ view] removeFromSuperview]; | 794 [[bookmarkBarController_ view] removeFromSuperview]; |
| 795 [self updateSubviewZOrder:fullscreen]; | 795 [self updateSubviewZOrder:fullscreen]; |
| 796 [self updateAllowOverlappingViews:fullscreen]; | |
| 797 } | 796 } |
| 798 | 797 |
| 799 - (void)showFullscreenExitBubbleIfNecessary { | 798 - (void)showFullscreenExitBubbleIfNecessary { |
| 800 // This method is called in response to | 799 // This method is called in response to |
| 801 // |-updateFullscreenExitBubbleURL:bubbleType:|. If we're in the middle of the | 800 // |-updateFullscreenExitBubbleURL:bubbleType:|. If we're in the middle of the |
| 802 // transition into fullscreen (i.e., using the System Fullscreen API), do not | 801 // transition into fullscreen (i.e., using the System Fullscreen API), do not |
| 803 // show the bubble because it will cause visual jank | 802 // show the bubble because it will cause visual jank |
| 804 // (http://crbug.com/130649). This will be called again as part of | 803 // (http://crbug.com/130649). This will be called again as part of |
| 805 // |-windowDidEnterFullScreen:|, so arrange to do that work then instead. | 804 // |-windowDidEnterFullScreen:|, so arrange to do that work then instead. |
| 806 if (enteringFullscreen_) | 805 if (enteringFullscreen_) |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 isPositioned:NSWindowAbove | 1023 isPositioned:NSWindowAbove |
| 1025 relativeTo:[bookmarkBarController_ view]]; | 1024 relativeTo:[bookmarkBarController_ view]]; |
| 1026 } else { | 1025 } else { |
| 1027 [contentView cr_ensureSubview:floatingBarBackingView_ | 1026 [contentView cr_ensureSubview:floatingBarBackingView_ |
| 1028 isPositioned:NSWindowBelow | 1027 isPositioned:NSWindowBelow |
| 1029 relativeTo:[bookmarkBarController_ view]]; | 1028 relativeTo:[bookmarkBarController_ view]]; |
| 1030 } | 1029 } |
| 1031 } | 1030 } |
| 1032 } | 1031 } |
| 1033 | 1032 |
| 1034 - (BOOL)shouldAllowOverlappingViews:(BOOL)inPresentationMode { | |
| 1035 if (inPresentationMode) | |
| 1036 return YES; | |
| 1037 | |
| 1038 if (findBarCocoaController_ && | |
| 1039 ![[findBarCocoaController_ findBarView] isHidden]) { | |
| 1040 return YES; | |
| 1041 } | |
| 1042 | |
| 1043 if (overlappedViewCount_) | |
| 1044 return YES; | |
| 1045 | |
| 1046 return NO; | |
| 1047 } | |
| 1048 | |
| 1049 - (void)updateAllowOverlappingViews:(BOOL)inPresentationMode { | |
| 1050 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); | |
| 1051 if (!contents) | |
| 1052 return; | |
| 1053 | |
| 1054 BOOL allowOverlappingViews = | |
| 1055 [self shouldAllowOverlappingViews:inPresentationMode]; | |
| 1056 | |
| 1057 // The rendering path with overlapping views disabled causes bugs when | |
| 1058 // transitioning between composited and non-composited mode. | |
| 1059 // http://crbug.com/279472 | |
| 1060 allowOverlappingViews = YES; | |
| 1061 contents->SetAllowOverlappingViews(allowOverlappingViews); | |
| 1062 | |
| 1063 WebContents* devTools = DevToolsWindow::GetInTabWebContents(contents, NULL); | |
| 1064 if (devTools) | |
| 1065 devTools->SetAllowOverlappingViews(allowOverlappingViews); | |
| 1066 } | |
| 1067 | |
| 1068 - (void)updateInfoBarTipVisibility { | 1033 - (void)updateInfoBarTipVisibility { |
| 1069 // If there's no toolbar then hide the infobar tip. | 1034 // If there's no toolbar then hide the infobar tip. |
| 1070 [infoBarContainerController_ | 1035 [infoBarContainerController_ |
| 1071 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; | 1036 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; |
| 1072 } | 1037 } |
| 1073 | 1038 |
| 1074 @end // @implementation BrowserWindowController(Private) | 1039 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |