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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 1276383004: Implemented fullscreen exit animation with AppKit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed format issues Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
index 4d02ca5a9d775444404b2ad90fb15fccdfb5749f..4e1c9d926ed751eeca2444f600b0c07bf2c4dee9 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -22,7 +22,7 @@
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window_state.h"
-#import "chrome/browser/ui/cocoa/browser_window_enter_fullscreen_transition.h"
+#import "chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h"
#import "chrome/browser/ui/cocoa/browser_window_layout.h"
#import "chrome/browser/ui/cocoa/custom_frame_view.h"
#import "chrome/browser/ui/cocoa/dev_tools_controller.h"
@@ -38,6 +38,7 @@
#import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h"
#import "chrome/browser/ui/cocoa/status_bubble_mac.h"
#import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h"
+#import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
#import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
#import "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h"
@@ -221,6 +222,7 @@ willPositionSheet:(NSWindow*)sheet
[(id)self.window setShouldHideTitle:![self hasTitleBar]];
[bookmarkBarController_ updateHiddenState];
+
[self updateSubviewZOrder];
base::scoped_nsobject<BrowserWindowLayout> layout(
@@ -689,7 +691,7 @@ willPositionSheet:(NSWindow*)sheet
[self registerForContentViewResizeNotifications];
NSWindow* window = [self window];
- savedRegularWindowFrame_ = [window frame];
+ savedRegularWindowFrame_ = [window frame];
BOOL mode = enteringPresentationMode_ ||
browser_->exclusive_access_manager()
->fullscreen_controller()
@@ -706,8 +708,6 @@ willPositionSheet:(NSWindow*)sheet
}
- (void)windowDidEnterFullScreen:(NSNotification*)notification {
- enterFullscreenTransition_.reset();
erikchen 2015/08/10 18:06:24 did you mean to replace with fullscreenTransition_
spqchan1 2015/08/11 21:43:47 Done
-
// In Yosemite, some combination of the titlebar and toolbar always show in
// full-screen mode. We do not want either to show. Search for the window that
// contains the views, and hide it. There is no need to ever unhide the view.
@@ -761,25 +761,40 @@ willPositionSheet:(NSWindow*)sheet
- (void)windowWillExitFullScreen:(NSNotification*)notification {
if (notification) // For System Fullscreen when non-nil.
[self registerForContentViewResizeNotifications];
+ exitingAppKitFullscreen_ = YES;
+
[self destroyFullscreenExitBubbleIfNecessary];
[self adjustUIForExitingFullscreenAndStopOmniboxSliding];
}
- (void)windowDidExitFullScreen:(NSNotification*)notification {
+ fullscreenTransition_.reset();
if (notification) // For System Fullscreen when non-nil.
[self deregisterForContentViewResizeNotifications];
+
+ FramedBrowserWindow* framedWindow = (FramedBrowserWindow*)[self window];
+ [framedWindow setFrameAndStyleLock:NO];
+
+ if (exitingAppKitFullscreen_) {
erikchen 2015/08/10 18:06:24 Is it possible for this to be false? If not, you s
spqchan1 2015/08/11 21:43:47 Done.
+ [self layoutSubviews];
+ }
+ exitingAppKitFullscreen_ = NO;
+
browser_->WindowFullscreenStateChanged();
}
- (void)windowDidFailToEnterFullScreen:(NSWindow*)window {
[self deregisterForContentViewResizeNotifications];
enteringAppKitFullscreen_ = NO;
+ FramedBrowserWindow* framedWindow = (FramedBrowserWindow*)[self window];
erikchen 2015/08/10 18:06:24 We don't use C style casts. See other examples in
spqchan1 2015/08/11 21:43:47 Done.
+ [framedWindow setFrameAndStyleLock:NO];
[self adjustUIForExitingFullscreenAndStopOmniboxSliding];
+
}
- (void)windowDidFailToExitFullScreen:(NSWindow*)window {
[self deregisterForContentViewResizeNotifications];
-
+ exitingAppKitFullscreen_ = NO;
// Force a relayout to try and get the window back into a reasonable state.
[self layoutSubviews];
}
@@ -876,7 +891,10 @@ willPositionSheet:(NSWindow*)sheet
- (void)updateLayoutParameters:(BrowserWindowLayout*)layout {
[layout setContentViewSize:[[[self window] contentView] bounds].size];
- [layout setWindowSize:[[self window] frame].size];
+
+ NSSize windowSize = (exitingAppKitFullscreen_) ?
+ [[[self window] contentView] bounds].size : [[self window] frame].size;
erikchen 2015/08/10 18:06:24 Can you explain this logic? Also, can you move the
spqchan1 2015/08/12 21:07:36 Done, moved logic into "getDesiredWindowLayoutSize
+ [layout setWindowSize:windowSize];
[layout setInAnyFullscreen:[self isInAnyFullscreenMode]];
[layout setFullscreenSlidingStyle:
@@ -1094,21 +1112,43 @@ willPositionSheet:(NSWindow*)sheet
if (![self shouldUseCustomAppKitFullscreenTransition])
return nil;
- enterFullscreenTransition_.reset(
- [[BrowserWindowEnterFullscreenTransition alloc]
- initWithWindow:self.window]);
- return [enterFullscreenTransition_ customWindowsToEnterFullScreen];
+ FramedBrowserWindow* framedBrowserWindow =
+ base::mac::ObjCCast<FramedBrowserWindow>([self window]);
+ fullscreenTransition_.reset(
+ [[BrowserWindowFullscreenTransition alloc]
+ initWithWindow:framedBrowserWindow]);
+ return [fullscreenTransition_ customWindowsToEnterFullScreenTransition];
+}
+
+- (NSArray*)customWindowsToExitFullScreenForWindow:(NSWindow*)window {
+ DCHECK([window isEqual:self.window]);
+
+ if (![self shouldUseCustomAppKitFullscreenTransition]) {
erikchen 2015/08/10 18:06:24 nit: The Chrome style is typically to only use {}
spqchan1 2015/08/11 21:43:47 Done.
+ return nil;
+ }
+
+ return [fullscreenTransition_ customWindowsToExitFullScreenTransition];
}
+
- (void)window:(NSWindow*)window
startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration {
DCHECK([window isEqual:self.window]);
- [enterFullscreenTransition_
- startCustomAnimationToEnterFullScreenWithDuration:duration];
+ [fullscreenTransition_
+ startCustomEnterFullScreenAnimationWithDuration:duration];
}
+- (void)window:(NSWindow*)window
+ startCustomAnimationToExitFullScreenWithDuration:(NSTimeInterval)duration {
+ DCHECK([window isEqual:self.window]);
+
+ [fullscreenTransition_
+ startCustomExitFullScreenAnimationWithDuration:duration];
+}
+
+
- (BOOL)shouldConstrainFrameRect {
- if ([enterFullscreenTransition_ shouldWindowBeUnconstrained])
+ if ([fullscreenTransition_ shouldWindowBeUnconstrained])
return NO;
return [super shouldConstrainFrameRect];

Powered by Google App Engine
This is Rietveld 408576698