| 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 // If the relayout shifts the content area up or down, let the renderer know. | 516 // If the relayout shifts the content area up or down, let the renderer know. |
| 517 if (contentShifted) { | 517 if (contentShifted) { |
| 518 if (WebContents* contents = | 518 if (WebContents* contents = |
| 519 browser_->tab_strip_model()->GetActiveWebContents()) { | 519 browser_->tab_strip_model()->GetActiveWebContents()) { |
| 520 if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) | 520 if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) |
| 521 rwhv->WindowFrameChanged(); | 521 rwhv->WindowFrameChanged(); |
| 522 } | 522 } |
| 523 } | 523 } |
| 524 } | 524 } |
| 525 | 525 |
| 526 - (void)updateRoundedBottomCorners { |
| 527 [[self tabContentArea] setRoundedBottomCorners:![self isFullscreen]]; |
| 528 } |
| 529 |
| 526 - (void)adjustToolbarAndBookmarkBarForCompression:(CGFloat)compression { | 530 - (void)adjustToolbarAndBookmarkBarForCompression:(CGFloat)compression { |
| 527 CGFloat newHeight = | 531 CGFloat newHeight = |
| 528 [toolbarController_ desiredHeightForCompression:compression]; | 532 [toolbarController_ desiredHeightForCompression:compression]; |
| 529 NSRect toolbarFrame = [[toolbarController_ view] frame]; | 533 NSRect toolbarFrame = [[toolbarController_ view] frame]; |
| 530 CGFloat deltaH = newHeight - toolbarFrame.size.height; | 534 CGFloat deltaH = newHeight - toolbarFrame.size.height; |
| 531 | 535 |
| 532 if (deltaH == 0) | 536 if (deltaH == 0) |
| 533 return; | 537 return; |
| 534 | 538 |
| 535 toolbarFrame.size.height = newHeight; | 539 toolbarFrame.size.height = newHeight; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 909 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 906 if (command_line->HasSwitch(switches::kEnableSimplifiedFullscreen) && | 910 if (command_line->HasSwitch(switches::kEnableSimplifiedFullscreen) && |
| 907 fullscreenUrl_.is_empty()) { | 911 fullscreenUrl_.is_empty()) { |
| 908 fullscreenModeController_.reset([[FullscreenModeController alloc] | 912 fullscreenModeController_.reset([[FullscreenModeController alloc] |
| 909 initWithBrowserWindowController:self]); | 913 initWithBrowserWindowController:self]); |
| 910 } | 914 } |
| 911 | 915 |
| 912 [self showFullscreenExitBubbleIfNecessary]; | 916 [self showFullscreenExitBubbleIfNecessary]; |
| 913 browser_->WindowFullscreenStateChanged(); | 917 browser_->WindowFullscreenStateChanged(); |
| 914 [[[self window] cr_windowView] setWantsLayer:NO]; | 918 [[[self window] cr_windowView] setWantsLayer:NO]; |
| 919 [self updateRoundedBottomCorners]; |
| 915 } | 920 } |
| 916 | 921 |
| 917 - (void)windowWillExitFullScreen:(NSNotification*)notification { | 922 - (void)windowWillExitFullScreen:(NSNotification*)notification { |
| 918 if (notification) // For System Fullscreen when non-nil. | 923 if (notification) // For System Fullscreen when non-nil. |
| 919 [self registerForContentViewResizeNotifications]; | 924 [self registerForContentViewResizeNotifications]; |
| 920 fullscreenModeController_.reset(); | 925 fullscreenModeController_.reset(); |
| 921 [self destroyFullscreenExitBubbleIfNecessary]; | 926 [self destroyFullscreenExitBubbleIfNecessary]; |
| 922 [self setPresentationModeInternal:NO forceDropdown:NO]; | 927 [self setPresentationModeInternal:NO forceDropdown:NO]; |
| 923 } | 928 } |
| 924 | 929 |
| 925 - (void)windowDidExitFullScreen:(NSNotification*)notification { | 930 - (void)windowDidExitFullScreen:(NSNotification*)notification { |
| 926 if (notification) // For System Fullscreen when non-nil. | 931 if (notification) // For System Fullscreen when non-nil. |
| 927 [self deregisterForContentViewResizeNotifications]; | 932 [self deregisterForContentViewResizeNotifications]; |
| 928 browser_->WindowFullscreenStateChanged(); | 933 browser_->WindowFullscreenStateChanged(); |
| 934 [self updateRoundedBottomCorners]; |
| 929 } | 935 } |
| 930 | 936 |
| 931 - (void)windowDidFailToEnterFullScreen:(NSWindow*)window { | 937 - (void)windowDidFailToEnterFullScreen:(NSWindow*)window { |
| 932 [self deregisterForContentViewResizeNotifications]; | 938 [self deregisterForContentViewResizeNotifications]; |
| 933 enteringFullscreen_ = NO; | 939 enteringFullscreen_ = NO; |
| 934 [self setPresentationModeInternal:NO forceDropdown:NO]; | 940 [self setPresentationModeInternal:NO forceDropdown:NO]; |
| 935 | 941 |
| 936 // Force a relayout to try and get the window back into a reasonable state. | 942 // Force a relayout to try and get the window back into a reasonable state. |
| 937 [self layoutSubviews]; | 943 [self layoutSubviews]; |
| 938 } | 944 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 devTools->SetAllowOverlappingViews(allowOverlappingViews); | 1080 devTools->SetAllowOverlappingViews(allowOverlappingViews); |
| 1075 } | 1081 } |
| 1076 | 1082 |
| 1077 - (void)updateInfoBarTipVisibility { | 1083 - (void)updateInfoBarTipVisibility { |
| 1078 // If there's no toolbar then hide the infobar tip. | 1084 // If there's no toolbar then hide the infobar tip. |
| 1079 [infoBarContainerController_ | 1085 [infoBarContainerController_ |
| 1080 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; | 1086 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; |
| 1081 } | 1087 } |
| 1082 | 1088 |
| 1083 @end // @implementation BrowserWindowController(Private) | 1089 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |