Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 7890056: FullscreenExitBubble temp UI for Mac. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix url? Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "base/memory/scoped_nsobject.h" 10 #import "base/memory/scoped_nsobject.h"
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 // We're done moving focus, so re-enable bar visibility changes. 676 // We're done moving focus, so re-enable bar visibility changes.
677 [self enableBarVisibilityUpdates]; 677 [self enableBarVisibilityUpdates];
678 } 678 }
679 679
680 - (void)setPresentationModeInternal:(BOOL)presentationMode 680 - (void)setPresentationModeInternal:(BOOL)presentationMode
681 forceDropdown:(BOOL)forceDropdown { 681 forceDropdown:(BOOL)forceDropdown {
682 if (presentationMode == [self inPresentationMode]) 682 if (presentationMode == [self inPresentationMode])
683 return; 683 return;
684 684
685 if (presentationMode) { 685 if (presentationMode) {
686 BOOL showDropdown = forceDropdown || [self floatingBarHasFocus]; 686 BOOL fullscreen_for_tab = browser_->is_fullscreen_for_tab();
687 BOOL showDropdown = !fullscreen_for_tab &&
688 (forceDropdown || [self floatingBarHasFocus]);
687 NSView* contentView = [[self window] contentView]; 689 NSView* contentView = [[self window] contentView];
688 presentationModeController_.reset( 690 presentationModeController_.reset(
689 [[PresentationModeController alloc] initWithBrowserController:self]); 691 [[PresentationModeController alloc] initWithBrowserController:self]);
690 [presentationModeController_ enterPresentationModeForContentView:contentView 692 [presentationModeController_ enterPresentationModeForContentView:contentView
691 showDropdown:showDropdown]; 693 showDropdown:showDropdown];
692 } else { 694 } else {
693 [presentationModeController_ exitPresentationMode]; 695 [presentationModeController_ exitPresentationMode];
694 presentationModeController_.reset(); 696 presentationModeController_.reset();
695 } 697 }
696 698
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 // top chrome elements so it only sits atop the web contents. When in normal 785 // top chrome elements so it only sits atop the web contents. When in normal
784 // mode, it needs to draw over the bookmark bar and part of the toolbar. 786 // mode, it needs to draw over the bookmark bar and part of the toolbar.
785 [[infoBarContainerController_ view] removeFromSuperview]; 787 [[infoBarContainerController_ view] removeFromSuperview];
786 NSView* infoBarDest = [[self window] contentView]; 788 NSView* infoBarDest = [[self window] contentView];
787 [infoBarDest addSubview:[infoBarContainerController_ view] 789 [infoBarDest addSubview:[infoBarContainerController_ view]
788 positioned:fullscreen ? NSWindowBelow : NSWindowAbove 790 positioned:fullscreen ? NSWindowBelow : NSWindowAbove
789 relativeTo:fullscreen ? nil 791 relativeTo:fullscreen ? nil
790 : [toolbarController_ view]]; 792 : [toolbarController_ view]];
791 } 793 }
792 794
795 - (void)showFullscreenExitBubbleIfNecessary {
796 if (!browser_->is_fullscreen_for_tab()) {
797 return;
798 }
799
800 [presentationModeController_ ensureOverlayHiddenWithAnimation:NO delay:NO];
801
802 fullscreenExitBubbleController_.reset(
803 [[FullscreenExitBubbleController alloc] initWithOwner:self
804 browser:browser_.get()]);
805 NSView* contentView = [[self window] contentView];
806 CGFloat maxWidth = NSWidth([contentView frame]);
807 CGFloat maxY = NSMaxY([[[self window] contentView] frame]);
808 [fullscreenExitBubbleController_
809 positionInWindowAtTop:maxY width:maxWidth];
810 [contentView addSubview:[fullscreenExitBubbleController_ view]
811 positioned:NSWindowAbove relativeTo:[self tabContentArea]];
812 }
813
814 - (void)destroyFullscreenExitBubbleIfNecessary {
815 [[fullscreenExitBubbleController_ view] removeFromSuperview];
816 fullscreenExitBubbleController_.reset();
817 }
818
793 - (void)contentViewDidResize:(NSNotification*)notification { 819 - (void)contentViewDidResize:(NSNotification*)notification {
794 [self layoutSubviews]; 820 [self layoutSubviews];
795 } 821 }
796 822
797 - (void)registerForContentViewResizeNotifications { 823 - (void)registerForContentViewResizeNotifications {
798 [[NSNotificationCenter defaultCenter] 824 [[NSNotificationCenter defaultCenter]
799 addObserver:self 825 addObserver:self
800 selector:@selector(contentViewDidResize:) 826 selector:@selector(contentViewDidResize:)
801 name:NSViewFrameDidChangeNotification 827 name:NSViewFrameDidChangeNotification
802 object:[[self window] contentView]]; 828 object:[[self window] contentView]];
(...skipping 17 matching lines...) Expand all
820 NSApplicationPresentationAutoHideDock | 846 NSApplicationPresentationAutoHideDock |
821 NSApplicationPresentationAutoHideMenuBar); 847 NSApplicationPresentationAutoHideMenuBar);
822 } 848 }
823 849
824 - (void)windowWillEnterFullScreen:(NSNotification*)notification { 850 - (void)windowWillEnterFullScreen:(NSNotification*)notification {
825 [self registerForContentViewResizeNotifications]; 851 [self registerForContentViewResizeNotifications];
826 852
827 NSWindow* window = [self window]; 853 NSWindow* window = [self window];
828 savedRegularWindowFrame_ = [window frame]; 854 savedRegularWindowFrame_ = [window frame];
829 BOOL mode = [self shouldUsePresentationModeWhenEnteringFullscreen]; 855 BOOL mode = [self shouldUsePresentationModeWhenEnteringFullscreen];
856 mode = mode || browser_->is_fullscreen_for_tab();
830 [self setPresentationModeInternal:mode forceDropdown:NO]; 857 [self setPresentationModeInternal:mode forceDropdown:NO];
831 } 858 }
832 859
833 - (void)windowDidEnterFullScreen:(NSNotification*)notification { 860 - (void)windowDidEnterFullScreen:(NSNotification*)notification {
834 [self deregisterForContentViewResizeNotifications]; 861 [self deregisterForContentViewResizeNotifications];
835 } 862 }
836 863
837 - (void)windowWillExitFullScreen:(NSNotification*)notification { 864 - (void)windowWillExitFullScreen:(NSNotification*)notification {
838 [self registerForContentViewResizeNotifications]; 865 [self registerForContentViewResizeNotifications];
839 [self setPresentationModeInternal:NO forceDropdown:NO]; 866 [self setPresentationModeInternal:NO forceDropdown:NO];
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 - (void)disableBarVisibilityUpdates { 898 - (void)disableBarVisibilityUpdates {
872 // Early escape if there's nothing to do. 899 // Early escape if there's nothing to do.
873 if (!barVisibilityUpdatesEnabled_) 900 if (!barVisibilityUpdatesEnabled_)
874 return; 901 return;
875 902
876 barVisibilityUpdatesEnabled_ = NO; 903 barVisibilityUpdatesEnabled_ = NO;
877 [presentationModeController_ cancelAnimationAndTimers]; 904 [presentationModeController_ cancelAnimationAndTimers];
878 } 905 }
879 906
880 @end // @implementation BrowserWindowController(Private) 907 @end // @implementation BrowserWindowController(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698