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

Unified Diff: chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h

Issue 1276383004: Implemented fullscreen exit animation with AppKit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored the code to log UMA metrics 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_fullscreen_transition.h
diff --git a/chrome/browser/ui/cocoa/browser_window_enter_fullscreen_transition.h b/chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h
similarity index 72%
rename from chrome/browser/ui/cocoa/browser_window_enter_fullscreen_transition.h
rename to chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h
index d947200edfbad984fe189f5fbc940e898bcffdee..22c21fadcabb80fc58d6c06a3f5acb0458b71f81 100644
--- a/chrome/browser/ui/cocoa/browser_window_enter_fullscreen_transition.h
+++ b/chrome/browser/ui/cocoa/browser_window_fullscreen_transition.h
@@ -7,8 +7,11 @@
#import <Cocoa/Cocoa.h>
+#import "chrome/browser/ui/cocoa/framed_browser_window.h"
erikchen 2015/08/11 22:42:54 You can just a forward declaration instead. @class
spqchan1 2015/08/12 19:34:41 Done.
+
// This class is responsible for managing the custom transition of a
-// BrowserWindow from its normal state into an AppKit Fullscreen state.
+// BrowserWindow from its normal state into an AppKit Fullscreen state
+// and vice versa.
//
// By default, when AppKit Fullscreens a window, it creates a new virtual
// desktop and slides it in from the right of the screen. At the same time, the
@@ -28,7 +31,7 @@
// drawRect: is called. As a result, the animation is effectively a no-op. When
// the animation is finished, the new web content flashes in.
//
-// The window's delegate can override two methods to customize the transition.
+// The window's delegate can override four methods to customize the transition.
// -customWindowsToEnterFullScreenForWindow:
// The return of this method is an array of NSWindows. Each window that is
// returned will be added to the new virtual desktop after the animation is
@@ -36,6 +39,12 @@
// -window:startCustomAnimationToEnterFullScreenWithDuration:
// In this method, the window's delegate adds animations to the windows
// returned in the above method.
+// -customWindowsToExitFullScreenForWindow:
+// This method is similar to customWindowsToEnterFullScreenForWindow,
+// but is used for the animation is exiting full screen
erikchen 2015/08/11 22:42:54 grammar check.
spqchan1 2015/08/12 19:34:41 Done.
+// -window:startCustomAnimationToExitFullScreenWithDuration:
+// In this method, the window's delegate adds animations to the windows
+// returned in the above method.
//
// The goal of this class is to mimic the default animation, but instead of
// taking a snapshot of the final web content, it uses the live web content
@@ -72,32 +81,34 @@
// return [super constrainFrameRect:frame toScreen:screen];
// }
-@interface BrowserWindowEnterFullscreenTransition : NSObject
+@interface BrowserWindowFullscreenTransition : NSObject
// Designated initializer. |window| is the NSWindow that is going to be moved
// into a fullscreen Space (virtual desktop), and resized to have the same size
// as the screen. |window|'s root view must be layer backed.
-- (instancetype)initWithWindow:(NSWindow*)window;
+- (instancetype)initEnterWithWindow:(FramedBrowserWindow*)window;
erikchen 2015/08/11 22:42:54 Please add a comment indicating when each of these
spqchan1 2015/08/12 19:34:41 Done.
-// Returns the windows to be used in the custom transition.
-// - Takes a snapshot of the current window.
-// - Makes a new snapshot window which shows the snapshot in the same
-// location as the current window.
-// - Adds the style mask NSFullScreenWindowMask to the current window.
-// - Makes the current window transparent, and resizes the current window to
-// be the same size as the screen.
-- (NSArray*)customWindowsToEnterFullScreen;
+- (instancetype)initExitWithWindow:(FramedBrowserWindow*)window
+ frame:(NSRect)frame;
-// Begins the animations used for the custom fullscreen transition.
-// - Animates the snapshot to the full size of the screen while fading it out.
+// Returns the windows to be used in the custom fullscreen transition.
+- (NSArray*)customWindowsForFullScreenTransition;
+
+// These two methods begins animation for exit and enter fullscreen transitions
erikchen 2015/08/11 22:42:54 which two methods?
spqchan1 2015/08/12 19:34:41 Done.
+// In both methods, the following happens:
+// - Animates the snapshot to the expected final size of the window while
+// fading it out.
// - Animates the current window from it's original location to its final
// location, while fading it in.
+// In startCustomExitFullScreenAnimationWithDuration, the content view gets
erikchen 2015/08/11 22:42:54 Can you be more precise? Are you referring to the
spqchan1 2015/08/12 19:34:41 Done.
+// resized in order
erikchen 2015/08/11 22:42:55 remove newline.
spqchan1 2015/08/12 19:34:41 Done.
+// to avoid clipping from the window
erikchen 2015/08/11 22:42:55 missing period at end.
spqchan1 2015/08/12 19:34:41 Done.
+
// Note: The two animations are added to different layers in different windows.
// There is no explicit logic to keep the two animations in sync. If this
// proves to be a problem, the relevant layers should attempt to sync up their
// time offsets with CACurrentMediaTime().
-- (void)startCustomAnimationToEnterFullScreenWithDuration:
- (NSTimeInterval)duration;
+- (void)startCustomFullScreenAnimationWithDuration:(NSTimeInterval)duration;
// When this method returns true, the NSWindow method
// -constrainFrameRect:toScreen: must return the frame rect without
@@ -105,6 +116,12 @@
// hooking up this logic.
- (BOOL)shouldWindowBeUnconstrained;
+// Returns the size of the window we expect the BrowserWindowLayout to have.
+// During exit fullscreen transition, the content size shrinks while the
erikchen 2015/08/11 22:42:54 During /the/ exit fullscreen...
spqchan1 2015/08/12 19:34:41 Done.
+// window frame stays the same. When that happens, we want to set the
erikchen 2015/08/11 22:42:54 Precision of language: We are not setting BrowserW
spqchan1 2015/08/12 19:34:41 Fixed the comments so that it's more precise
+// BrowserWindowLayout to the content size instead of the window's size.
+- (NSSize)getDesiredWindowLayoutSize;
+
@end
#endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_FULLSCREEN_TRANSITION_H_

Powered by Google App Engine
This is Rietveld 408576698