| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 // It doesn't make sense to provide a Y higher than the height of the window. | 219 // It doesn't make sense to provide a Y higher than the height of the window. |
| 220 CGFloat windowHeight = NSHeight([window frame]); | 220 CGFloat windowHeight = NSHeight([window frame]); |
| 221 defaultSheetY = std::min(defaultSheetY, windowHeight); | 221 defaultSheetY = std::min(defaultSheetY, windowHeight); |
| 222 | 222 |
| 223 defaultSheetLocation.origin.y = defaultSheetY; | 223 defaultSheetLocation.origin.y = defaultSheetY; |
| 224 return defaultSheetLocation; | 224 return defaultSheetLocation; |
| 225 } | 225 } |
| 226 | 226 |
| 227 - (void)layoutSubviews { | 227 - (void)layoutSubviews { |
| 228 // TODO(spqchan): Change blockLayoutSubviews so that it only blocks the web |
| 229 // content from resizing. |
| 228 if (blockLayoutSubviews_) | 230 if (blockLayoutSubviews_) |
| 229 return; | 231 return; |
| 230 | 232 |
| 231 // Suppress title drawing if necessary. | 233 // Suppress title drawing if necessary. |
| 232 if ([self.window respondsToSelector:@selector(setShouldHideTitle:)]) | 234 if ([self.window respondsToSelector:@selector(setShouldHideTitle:)]) |
| 233 [(id)self.window setShouldHideTitle:![self hasTitleBar]]; | 235 [(id)self.window setShouldHideTitle:![self hasTitleBar]]; |
| 234 | 236 |
| 235 [bookmarkBarController_ updateHiddenState]; | 237 [bookmarkBarController_ updateHiddenState]; |
| 236 [self updateSubviewZOrder]; | 238 [self updateSubviewZOrder]; |
| 237 | 239 |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 } | 759 } |
| 758 | 760 |
| 759 if (notification) // For System Fullscreen when non-nil. | 761 if (notification) // For System Fullscreen when non-nil. |
| 760 [self deregisterForContentViewResizeNotifications]; | 762 [self deregisterForContentViewResizeNotifications]; |
| 761 enteringAppKitFullscreen_ = NO; | 763 enteringAppKitFullscreen_ = NO; |
| 762 enteringImmersiveFullscreen_ = NO; | 764 enteringImmersiveFullscreen_ = NO; |
| 763 enteringPresentationMode_ = NO; | 765 enteringPresentationMode_ = NO; |
| 764 isUsingCustomAnimation_ = NO; | 766 isUsingCustomAnimation_ = NO; |
| 765 | 767 |
| 766 [self showFullscreenExitBubbleIfNecessary]; | 768 [self showFullscreenExitBubbleIfNecessary]; |
| 769 [self layoutSubviews]; |
| 767 browser_->WindowFullscreenStateChanged(); | 770 browser_->WindowFullscreenStateChanged(); |
| 768 } | 771 } |
| 769 | 772 |
| 770 - (void)windowWillExitFullScreen:(NSNotification*)notification { | 773 - (void)windowWillExitFullScreen:(NSNotification*)notification { |
| 771 if (notification) // For System Fullscreen when non-nil. | 774 if (notification) // For System Fullscreen when non-nil. |
| 772 [self registerForContentViewResizeNotifications]; | 775 [self registerForContentViewResizeNotifications]; |
| 773 exitingAppKitFullscreen_ = YES; | 776 exitingAppKitFullscreen_ = YES; |
| 774 | 777 |
| 775 // Like windowWillEnterFullScreen, if we use custom animations, | 778 // Like windowWillEnterFullScreen, if we use custom animations, |
| 776 // adjustUIForExitingFullscreen should be called after the layout resizes in | 779 // adjustUIForExitingFullscreen should be called after the layout resizes in |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 [self destroyFullscreenExitBubbleIfNecessary]; | 822 [self destroyFullscreenExitBubbleIfNecessary]; |
| 820 [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; | 823 [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; |
| 821 } | 824 } |
| 822 | 825 |
| 823 - (void)adjustUIForEnteringFullscreen { | 826 - (void)adjustUIForEnteringFullscreen { |
| 824 fullscreen_mac::SlidingStyle style; | 827 fullscreen_mac::SlidingStyle style; |
| 825 if (browser_->exclusive_access_manager() | 828 if (browser_->exclusive_access_manager() |
| 826 ->fullscreen_controller() | 829 ->fullscreen_controller() |
| 827 ->IsWindowFullscreenForTabOrPending()) { | 830 ->IsWindowFullscreenForTabOrPending()) { |
| 828 style = fullscreen_mac::OMNIBOX_TABS_NONE; | 831 style = fullscreen_mac::OMNIBOX_TABS_NONE; |
| 829 } else if (enteringPresentationMode_) { | 832 } else if (enteringPresentationMode_ || [self shouldHideFullscreenToolbar]) { |
| 830 style = fullscreen_mac::OMNIBOX_TABS_HIDDEN; | 833 style = fullscreen_mac::OMNIBOX_TABS_HIDDEN; |
| 831 } else { | 834 } else { |
| 832 style = fullscreen_mac::OMNIBOX_TABS_PRESENT; | 835 style = fullscreen_mac::OMNIBOX_TABS_PRESENT; |
| 833 } | 836 } |
| 834 | 837 |
| 835 [self adjustUIForSlidingFullscreenStyle:style]; | 838 [self adjustUIForSlidingFullscreenStyle:style]; |
| 836 } | 839 } |
| 837 | 840 |
| 838 - (void)enableBarVisibilityUpdates { | 841 - (void)enableBarVisibilityUpdates { |
| 839 // Early escape if there's nothing to do. | 842 // Early escape if there's nothing to do. |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 return browser_->tab_strip_model()->GetActiveWebContents(); | 1219 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 1217 } | 1220 } |
| 1218 | 1221 |
| 1219 - (PermissionBubbleManager*)permissionBubbleManager { | 1222 - (PermissionBubbleManager*)permissionBubbleManager { |
| 1220 if (WebContents* contents = [self webContents]) | 1223 if (WebContents* contents = [self webContents]) |
| 1221 return PermissionBubbleManager::FromWebContents(contents); | 1224 return PermissionBubbleManager::FromWebContents(contents); |
| 1222 return nil; | 1225 return nil; |
| 1223 } | 1226 } |
| 1224 | 1227 |
| 1225 @end // @implementation BrowserWindowController(Private) | 1228 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |