| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 | 461 |
| 462 - (void)adjustUIForExitingFullscreenAndStopOmniboxSliding { | 462 - (void)adjustUIForExitingFullscreenAndStopOmniboxSliding { |
| 463 [fullscreenToolbarController_ exitFullscreenMode]; | 463 [fullscreenToolbarController_ exitFullscreenMode]; |
| 464 fullscreenToolbarController_.reset(); | 464 fullscreenToolbarController_.reset(); |
| 465 | 465 |
| 466 // Force the bookmark bar z-order to update. | 466 // Force the bookmark bar z-order to update. |
| 467 [[bookmarkBarController_ view] removeFromSuperview]; | 467 [[bookmarkBarController_ view] removeFromSuperview]; |
| 468 [self layoutSubviews]; | 468 [self layoutSubviews]; |
| 469 } | 469 } |
| 470 | 470 |
| 471 - (void)adjustUIForSlidingFullscreenStyle:(fullscreen_mac::SlidingStyle)style { | 471 - (void)adjustUIForSlidingFullscreenStyle:(FullscreenSlidingStyle)style { |
| 472 // The UI should only be adjusted in fullscreen mode. | 472 // The UI should only be adjusted in fullscreen mode. |
| 473 if (![self isInAnyFullscreenMode]) | 473 if (![self isInAnyFullscreenMode]) |
| 474 return; | 474 return; |
| 475 | 475 |
| 476 if (!fullscreenToolbarController_) { | 476 if (!fullscreenToolbarController_) { |
| 477 fullscreenToolbarController_.reset( | 477 fullscreenToolbarController_.reset( |
| 478 [self newFullscreenToolbarControllerWithStyle:style]); | 478 [self newFullscreenToolbarControllerWithStyle:style]); |
| 479 [self configureFullscreenToolbarController]; | 479 [self configureFullscreenToolbarController]; |
| 480 } else { | 480 } else { |
| 481 fullscreenToolbarController_.get().slidingStyle = style; | 481 fullscreenToolbarController_.get().slidingStyle = style; |
| 482 } | 482 } |
| 483 | 483 |
| 484 if (!floatingBarBackingView_.get() && | 484 if (!floatingBarBackingView_.get() && |
| 485 ([self hasTabStrip] || [self hasToolbar] || [self hasLocationBar])) { | 485 ([self hasTabStrip] || [self hasToolbar] || [self hasLocationBar])) { |
| 486 floatingBarBackingView_.reset( | 486 floatingBarBackingView_.reset( |
| 487 [[FloatingBarBackingView alloc] initWithFrame:NSZeroRect]); | 487 [[FloatingBarBackingView alloc] initWithFrame:NSZeroRect]); |
| 488 [floatingBarBackingView_ | 488 [floatingBarBackingView_ |
| 489 setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)]; | 489 setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)]; |
| 490 } | 490 } |
| 491 | 491 |
| 492 // Force the bookmark bar z-order to update. | 492 // Force the bookmark bar z-order to update. |
| 493 [[bookmarkBarController_ view] removeFromSuperview]; | 493 [[bookmarkBarController_ view] removeFromSuperview]; |
| 494 [self layoutSubviews]; | 494 [self layoutSubviews]; |
| 495 } | 495 } |
| 496 | 496 |
| 497 - (FullscreenToolbarController*)newFullscreenToolbarControllerWithStyle: | 497 - (FullscreenToolbarController*)newFullscreenToolbarControllerWithStyle: |
| 498 (fullscreen_mac::SlidingStyle)style { | 498 (FullscreenSlidingStyle)style { |
| 499 return [[FullscreenToolbarController alloc] initWithBrowserController:self | 499 return [[FullscreenToolbarController alloc] initWithBrowserController:self |
| 500 style:style]; | 500 style:style]; |
| 501 } | 501 } |
| 502 | 502 |
| 503 - (void)enterImmersiveFullscreen { | 503 - (void)enterImmersiveFullscreen { |
| 504 RecordFullscreenWindowLocation([self window]); | 504 RecordFullscreenWindowLocation([self window]); |
| 505 RecordFullscreenStyle(IMMERSIVE_FULLSCREEN); | 505 RecordFullscreenStyle(IMMERSIVE_FULLSCREEN); |
| 506 | 506 |
| 507 // Set to NO by |-windowDidEnterFullScreen:|. | 507 // Set to NO by |-windowDidEnterFullScreen:|. |
| 508 enteringImmersiveFullscreen_ = YES; | 508 enteringImmersiveFullscreen_ = YES; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 520 | 520 |
| 521 // Create the fullscreen window. | 521 // Create the fullscreen window. |
| 522 fullscreenWindow_.reset([[self createFullscreenWindow] retain]); | 522 fullscreenWindow_.reset([[self createFullscreenWindow] retain]); |
| 523 savedRegularWindow_ = [[self window] retain]; | 523 savedRegularWindow_ = [[self window] retain]; |
| 524 savedRegularWindowFrame_ = [savedRegularWindow_ frame]; | 524 savedRegularWindowFrame_ = [savedRegularWindow_ frame]; |
| 525 | 525 |
| 526 [self moveViewsForImmersiveFullscreen:YES | 526 [self moveViewsForImmersiveFullscreen:YES |
| 527 regularWindow:[self window] | 527 regularWindow:[self window] |
| 528 fullscreenWindow:fullscreenWindow_.get()]; | 528 fullscreenWindow:fullscreenWindow_.get()]; |
| 529 | 529 |
| 530 fullscreen_mac::SlidingStyle style = fullscreen_mac::OMNIBOX_TABS_HIDDEN; | 530 FullscreenSlidingStyle style = FullscreenSlidingStyle::OMNIBOX_TABS_HIDDEN; |
| 531 [self adjustUIForSlidingFullscreenStyle:style]; | 531 [self adjustUIForSlidingFullscreenStyle:style]; |
| 532 | 532 |
| 533 [fullscreenWindow_ display]; | 533 [fullscreenWindow_ display]; |
| 534 | 534 |
| 535 // AppKit is helpful and prevents NSWindows from having the same height as | 535 // AppKit is helpful and prevents NSWindows from having the same height as |
| 536 // the screen while the menu bar is showing. This only applies to windows on | 536 // the screen while the menu bar is showing. This only applies to windows on |
| 537 // a secondary screen, in a separate space. Calling [NSWindow | 537 // a secondary screen, in a separate space. Calling [NSWindow |
| 538 // setFrame:display:] with the screen's height will always reduce the | 538 // setFrame:display:] with the screen's height will always reduce the |
| 539 // height by the height of the MenuBar. Calling the method with any other | 539 // height by the height of the MenuBar. Calling the method with any other |
| 540 // height works fine. The relevant method in the 10.10 AppKit SDK is called: | 540 // height works fine. The relevant method in the 10.10 AppKit SDK is called: |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 else | 825 else |
| 826 [sheetController unhideSheetForFullscreenTransition]; | 826 [sheetController unhideSheetForFullscreenTransition]; |
| 827 } | 827 } |
| 828 | 828 |
| 829 - (void)adjustUIForExitingFullscreen { | 829 - (void)adjustUIForExitingFullscreen { |
| 830 exclusiveAccessController_->Destroy(); | 830 exclusiveAccessController_->Destroy(); |
| 831 [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; | 831 [self adjustUIForExitingFullscreenAndStopOmniboxSliding]; |
| 832 } | 832 } |
| 833 | 833 |
| 834 - (void)adjustUIForEnteringFullscreen { | 834 - (void)adjustUIForEnteringFullscreen { |
| 835 fullscreen_mac::SlidingStyle style; | 835 FullscreenSlidingStyle style = FullscreenSlidingStyle::OMNIBOX_TABS_PRESENT; |
| 836 if ([self isFullscreenForTabContentOrExtension]) { | 836 if ([self isFullscreenForTabContentOrExtension]) |
| 837 style = fullscreen_mac::OMNIBOX_TABS_NONE; | 837 style = FullscreenSlidingStyle::OMNIBOX_TABS_NONE; |
| 838 } else if (!shouldShowFullscreenToolbar_) { | 838 else if (!shouldShowFullscreenToolbar_) |
| 839 style = fullscreen_mac::OMNIBOX_TABS_HIDDEN; | 839 style = FullscreenSlidingStyle::OMNIBOX_TABS_HIDDEN; |
| 840 } else { | |
| 841 style = fullscreen_mac::OMNIBOX_TABS_PRESENT; | |
| 842 } | |
| 843 | 840 |
| 844 [self adjustUIForSlidingFullscreenStyle:style]; | 841 [self adjustUIForSlidingFullscreenStyle:style]; |
| 845 } | 842 } |
| 846 | 843 |
| 847 - (void)enableBarVisibilityUpdates { | 844 - (void)enableBarVisibilityUpdates { |
| 848 // Early escape if there's nothing to do. | 845 // Early escape if there's nothing to do. |
| 849 if (barVisibilityUpdatesEnabled_) | 846 if (barVisibilityUpdatesEnabled_) |
| 850 return; | 847 return; |
| 851 | 848 |
| 852 barVisibilityUpdatesEnabled_ = YES; | 849 barVisibilityUpdatesEnabled_ = YES; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 - (void)updateLayoutParameters:(BrowserWindowLayout*)layout { | 930 - (void)updateLayoutParameters:(BrowserWindowLayout*)layout { |
| 934 [layout setContentViewSize:[[[self window] contentView] bounds].size]; | 931 [layout setContentViewSize:[[[self window] contentView] bounds].size]; |
| 935 | 932 |
| 936 NSSize windowSize = (fullscreenTransition_.get()) | 933 NSSize windowSize = (fullscreenTransition_.get()) |
| 937 ? [fullscreenTransition_ desiredWindowLayoutSize] | 934 ? [fullscreenTransition_ desiredWindowLayoutSize] |
| 938 : [[self window] frame].size; | 935 : [[self window] frame].size; |
| 939 | 936 |
| 940 [layout setWindowSize:windowSize]; | 937 [layout setWindowSize:windowSize]; |
| 941 | 938 |
| 942 [layout setInAnyFullscreen:[self isInAnyFullscreenMode]]; | 939 [layout setInAnyFullscreen:[self isInAnyFullscreenMode]]; |
| 943 [layout setFullscreenSlidingStyle:fullscreenToolbarController_.get() | 940 [layout setSlidingStyle:fullscreenToolbarController_.get().slidingStyle]; |
| 944 .slidingStyle]; | |
| 945 [layout | 941 [layout |
| 946 setFullscreenMenubarOffset:[fullscreenToolbarController_ menubarOffset]]; | 942 setFullscreenMenubarOffset:[fullscreenToolbarController_ menubarOffset]]; |
| 947 [layout setFullscreenToolbarFraction:[fullscreenToolbarController_ | 943 [layout setFullscreenToolbarFraction:[fullscreenToolbarController_ |
| 948 toolbarFraction]]; | 944 toolbarFraction]]; |
| 949 | 945 |
| 950 [layout setHasTabStrip:[self hasTabStrip]]; | 946 [layout setHasTabStrip:[self hasTabStrip]]; |
| 951 [layout setFullscreenButtonFrame:[self fullscreenButtonFrame]]; | 947 [layout setFullscreenButtonFrame:[self fullscreenButtonFrame]]; |
| 952 | 948 |
| 953 if ([self shouldShowAvatar]) { | 949 if ([self shouldShowAvatar]) { |
| 954 NSView* avatar = [avatarButtonController_ view]; | 950 NSView* avatar = [avatarButtonController_ view]; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 if (fullscreenLowPowerCoordinator_) | 1264 if (fullscreenLowPowerCoordinator_) |
| 1269 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); | 1265 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); |
| 1270 } | 1266 } |
| 1271 | 1267 |
| 1272 - (void)childWindowsDidChange { | 1268 - (void)childWindowsDidChange { |
| 1273 if (fullscreenLowPowerCoordinator_) | 1269 if (fullscreenLowPowerCoordinator_) |
| 1274 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); | 1270 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); |
| 1275 } | 1271 } |
| 1276 | 1272 |
| 1277 @end // @implementation BrowserWindowController(Private) | 1273 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |