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

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

Issue 846443004: mac: Implement custom AppKit Enter Fullscreen transition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from andresantoso, round 2. Created 5 years, 11 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 36a9ccd5d0fde2f556e7de584b576f03888fcd0c..55524f1b6296f50cfb2e76e24177da06b8e4fca8 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -22,6 +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_layout.h"
#import "chrome/browser/ui/cocoa/dev_tools_controller.h"
#import "chrome/browser/ui/cocoa/fast_resize_view.h"
@@ -682,6 +683,8 @@ willPositionSheet:(NSWindow*)sheet
}
- (void)windowDidEnterFullScreen:(NSNotification*)notification {
+ enterFullscreenTransition_.reset();
+
// 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.
@@ -1017,4 +1020,37 @@ willPositionSheet:(NSWindow*)sheet
return YES;
}
+- (BOOL)shouldUseCustomAppKitFullscreenTransition {
+ if (base::mac::IsOSMountainLionOrEarlier())
+ return NO;
+ NSView* root = [[self.window contentView] superview];
+ return root.layer != nil;
+}
+
+- (NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow*)window {
+ DCHECK([window isEqual:self.window]);
+
+ if (![self shouldUseCustomAppKitFullscreenTransition])
+ return nil;
+
+ enterFullscreenTransition_.reset(
+ [[BrowserWindowEnterFullscreenTransition alloc]
+ initWithWindow:self.window]);
+ return [enterFullscreenTransition_ customWindowsToEnterFullScreen];
+}
+
+- (void)window:(NSWindow*)window
+ startCustomAnimationToEnterFullScreenWithDuration:(NSTimeInterval)duration {
+ DCHECK([window isEqual:self.window]);
+ [enterFullscreenTransition_
+ startCustomAnimationToEnterFullScreenWithDuration:duration];
+}
+
+- (BOOL)shouldConstrainFrameRect {
+ if ([enterFullscreenTransition_ shouldWindowBeUnconstrained])
+ return NO;
+
+ return [super shouldConstrainFrameRect];
+}
+
@end // @implementation BrowserWindowController(Private)

Powered by Google App Engine
This is Rietveld 408576698