| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 // It doesn't make sense to provide a Y higher than the height of the window. | 211 // It doesn't make sense to provide a Y higher than the height of the window. |
| 212 CGFloat windowHeight = NSHeight([window frame]); | 212 CGFloat windowHeight = NSHeight([window frame]); |
| 213 defaultSheetY = std::min(defaultSheetY, windowHeight); | 213 defaultSheetY = std::min(defaultSheetY, windowHeight); |
| 214 | 214 |
| 215 defaultSheetLocation.origin.y = defaultSheetY; | 215 defaultSheetLocation.origin.y = defaultSheetY; |
| 216 return defaultSheetLocation; | 216 return defaultSheetLocation; |
| 217 } | 217 } |
| 218 | 218 |
| 219 - (void)layoutSubviews { | 219 - (void)layoutSubviews { |
| 220 // TODO(spqchan): Change blockLayoutSubviews so that it only blocks the web |
| 221 // content from resizing. |
| 220 if (blockLayoutSubviews_) | 222 if (blockLayoutSubviews_) |
| 221 return; | 223 return; |
| 222 | 224 |
| 223 // Suppress title drawing if necessary. | 225 // Suppress title drawing if necessary. |
| 224 if ([self.window respondsToSelector:@selector(setShouldHideTitle:)]) | 226 if ([self.window respondsToSelector:@selector(setShouldHideTitle:)]) |
| 225 [(id)self.window setShouldHideTitle:![self hasTitleBar]]; | 227 [(id)self.window setShouldHideTitle:![self hasTitleBar]]; |
| 226 | 228 |
| 227 [bookmarkBarController_ updateHiddenState]; | 229 [bookmarkBarController_ updateHiddenState]; |
| 228 [self updateSubviewZOrder]; | 230 [self updateSubviewZOrder]; |
| 229 | 231 |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 base::MessageLoop::current()->PostTask(FROM_HERE, callback); | 743 base::MessageLoop::current()->PostTask(FROM_HERE, callback); |
| 742 } | 744 } |
| 743 | 745 |
| 744 if (notification) // For System Fullscreen when non-nil. | 746 if (notification) // For System Fullscreen when non-nil. |
| 745 [self deregisterForContentViewResizeNotifications]; | 747 [self deregisterForContentViewResizeNotifications]; |
| 746 enteringAppKitFullscreen_ = NO; | 748 enteringAppKitFullscreen_ = NO; |
| 747 enteringImmersiveFullscreen_ = NO; | 749 enteringImmersiveFullscreen_ = NO; |
| 748 enteringPresentationMode_ = NO; | 750 enteringPresentationMode_ = NO; |
| 749 | 751 |
| 750 [self showFullscreenExitBubbleIfNecessary]; | 752 [self showFullscreenExitBubbleIfNecessary]; |
| 753 [self layoutSubviews]; |
| 751 browser_->WindowFullscreenStateChanged(); | 754 browser_->WindowFullscreenStateChanged(); |
| 752 } | 755 } |
| 753 | 756 |
| 754 - (void)windowWillExitFullScreen:(NSNotification*)notification { | 757 - (void)windowWillExitFullScreen:(NSNotification*)notification { |
| 755 if (notification) // For System Fullscreen when non-nil. | 758 if (notification) // For System Fullscreen when non-nil. |
| 756 [self registerForContentViewResizeNotifications]; | 759 [self registerForContentViewResizeNotifications]; |
| 757 exitingAppKitFullscreen_ = YES; | 760 exitingAppKitFullscreen_ = YES; |
| 758 | 761 |
| 759 // Like windowWillEnterFullScreen, if we use custom animations, | 762 // Like windowWillEnterFullScreen, if we use custom animations, |
| 760 // adjustUIForExitingFullscreen should be called after the layout resizes in | 763 // adjustUIForExitingFullscreen should be called after the layout resizes in |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 [self destroyFullscreenExitBubbleIfNecessary]; | 803 [self destroyFullscreenExitBubbleIfNecessary]; |
| 801 [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; | 804 [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; |
| 802 } | 805 } |
| 803 | 806 |
| 804 - (void)adjustUIForEnteringFullscreen { | 807 - (void)adjustUIForEnteringFullscreen { |
| 805 fullscreen_mac::SlidingStyle style; | 808 fullscreen_mac::SlidingStyle style; |
| 806 if (browser_->exclusive_access_manager() | 809 if (browser_->exclusive_access_manager() |
| 807 ->fullscreen_controller() | 810 ->fullscreen_controller() |
| 808 ->IsWindowFullscreenForTabOrPending()) { | 811 ->IsWindowFullscreenForTabOrPending()) { |
| 809 style = fullscreen_mac::OMNIBOX_TABS_NONE; | 812 style = fullscreen_mac::OMNIBOX_TABS_NONE; |
| 810 } else if (enteringPresentationMode_) { | 813 } else if (enteringPresentationMode_ || [self shouldHideFullscreenToolbar]) { |
| 811 style = fullscreen_mac::OMNIBOX_TABS_HIDDEN; | 814 style = fullscreen_mac::OMNIBOX_TABS_HIDDEN; |
| 812 } else { | 815 } else { |
| 813 style = fullscreen_mac::OMNIBOX_TABS_PRESENT; | 816 style = fullscreen_mac::OMNIBOX_TABS_PRESENT; |
| 814 } | 817 } |
| 815 | 818 |
| 816 [self adjustUIForSlidingFullscreenStyle:style]; | 819 [self adjustUIForSlidingFullscreenStyle:style]; |
| 817 } | 820 } |
| 818 | 821 |
| 819 - (void)enableBarVisibilityUpdates { | 822 - (void)enableBarVisibilityUpdates { |
| 820 // Early escape if there's nothing to do. | 823 // Early escape if there's nothing to do. |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 return browser_->tab_strip_model()->GetActiveWebContents(); | 1193 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 1191 } | 1194 } |
| 1192 | 1195 |
| 1193 - (PermissionBubbleManager*)permissionBubbleManager { | 1196 - (PermissionBubbleManager*)permissionBubbleManager { |
| 1194 if (WebContents* contents = [self webContents]) | 1197 if (WebContents* contents = [self webContents]) |
| 1195 return PermissionBubbleManager::FromWebContents(contents); | 1198 return PermissionBubbleManager::FromWebContents(contents); |
| 1196 return nil; | 1199 return nil; |
| 1197 } | 1200 } |
| 1198 | 1201 |
| 1199 @end // @implementation BrowserWindowController(Private) | 1202 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |