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

Side by Side Diff: chrome/browser/ui/cocoa/presentation_mode_controller.h

Issue 7566016: Fullscreen support for Lion. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_UI_COCOA_FULLSCREEN_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_PRESENTATION_MODE_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_FULLSCREEN_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_COCOA_PRESENTATION_MODE_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 #import <Cocoa/Cocoa.h> 9 #import <Cocoa/Cocoa.h>
10 10
11 #import "base/mac/cocoa_protocols.h" 11 #import "base/mac/cocoa_protocols.h"
12 #include "base/mac/mac_util.h" 12 #include "base/mac/mac_util.h"
13 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 13 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
14 14
15 @class BrowserWindowController; 15 @class BrowserWindowController;
16 @class DropdownAnimation; 16 @class DropdownAnimation;
17 17
18 // Provides a controller to manage fullscreen mode for a single browser window. 18 // Provides a controller to manage presentation mode for a single browser
19 // This class handles running animations, showing and hiding the floating 19 // window. This class handles running animations, showing and hiding the
20 // dropdown bar, and managing the tracking area associated with the dropdown. 20 // floating dropdown bar, and managing the tracking area associated with the
21 // This class does not directly manage any views -- the BrowserWindowController 21 // dropdown. This class does not directly manage any views -- the
22 // is responsible for positioning and z-ordering views. 22 // BrowserWindowController is responsible for positioning and z-ordering views.
23 // 23 //
24 // Tracking areas are disabled while animations are running. If 24 // Tracking areas are disabled while animations are running. If
25 // |overlayFrameChanged:| is called while an animation is running, the 25 // |overlayFrameChanged:| is called while an animation is running, the
26 // controller saves the new frame and installs the appropriate tracking area 26 // controller saves the new frame and installs the appropriate tracking area
27 // when the animation finishes. This is largely done for ease of 27 // when the animation finishes. This is largely done for ease of
28 // implementation; it is easier to check the mouse location at each animation 28 // implementation; it is easier to check the mouse location at each animation
29 // step than it is to manage a constantly-changing tracking area. 29 // step than it is to manage a constantly-changing tracking area.
30 @interface FullscreenController : NSObject<NSAnimationDelegate> { 30 @interface PresentationModeController : NSObject<NSAnimationDelegate> {
31 @private 31 @private
32 // Our parent controller. 32 // Our parent controller.
33 BrowserWindowController* browserController_; // weak 33 BrowserWindowController* browserController_; // weak
34 34
35 // The content view for the fullscreen window. This is nil when not in 35 // The content view for the window. This is nil when not in presentation
36 // fullscreen mode. 36 // mode.
37 NSView* contentView_; // weak 37 NSView* contentView_; // weak
38 38
39 // Whether or not we are in fullscreen mode. 39 // YES while this controller is in the process of entering presentation mode.
40 BOOL isFullscreen_; 40 BOOL enteringPresentationMode_;
41
42 // Whether or not we are in presentation mode.
43 BOOL inPresentationMode_;
41 44
42 // The tracking area associated with the floating dropdown bar. This tracking 45 // The tracking area associated with the floating dropdown bar. This tracking
43 // area is attached to |contentView_|, because when the dropdown is completely 46 // area is attached to |contentView_|, because when the dropdown is completely
44 // hidden, we still need to keep a 1px tall tracking area visible. Attaching 47 // hidden, we still need to keep a 1px tall tracking area visible. Attaching
45 // to the content view allows us to do this. |trackingArea_| can be nil if 48 // to the content view allows us to do this. |trackingArea_| can be nil if
46 // not in fullscreen mode or during animations. 49 // not in presentation mode or during animations.
47 scoped_nsobject<NSTrackingArea> trackingArea_; 50 scoped_nsobject<NSTrackingArea> trackingArea_;
48 51
49 // Pointer to the currently running animation. Is nil if no animation is 52 // Pointer to the currently running animation. Is nil if no animation is
50 // running. 53 // running.
51 scoped_nsobject<DropdownAnimation> currentAnimation_; 54 scoped_nsobject<DropdownAnimation> currentAnimation_;
52 55
53 // Timers for scheduled showing/hiding of the bar (which are always done with 56 // Timers for scheduled showing/hiding of the bar (which are always done with
54 // animation). 57 // animation).
55 scoped_nsobject<NSTimer> showTimer_; 58 scoped_nsobject<NSTimer> showTimer_;
56 scoped_nsobject<NSTimer> hideTimer_; 59 scoped_nsobject<NSTimer> hideTimer_;
57 60
58 // Holds the current bounds of |trackingArea_|, even if |trackingArea_| is 61 // Holds the current bounds of |trackingArea_|, even if |trackingArea_| is
59 // currently nil. Used to restore the tracking area when an animation 62 // currently nil. Used to restore the tracking area when an animation
60 // completes. 63 // completes.
61 NSRect trackingAreaBounds_; 64 NSRect trackingAreaBounds_;
62 65
63 // Tracks the currently requested fullscreen mode. This should be 66 // Tracks the currently requested system fullscreen mode, used to show or hide
64 // |kFullScreenModeNormal| when the window is not main or not fullscreen, 67 // the menubar. This should be |kFullScreenModeNormal| when the window is not
65 // |kFullScreenModeHideAll| while the overlay is hidden, and 68 // main or not fullscreen, |kFullScreenModeHideAll| while the overlay is
66 // |kFullScreenModeHideDock| while the overlay is shown. If the window is not 69 // hidden, and |kFullScreenModeHideDock| while the overlay is shown. If the
67 // on the primary screen, this should always be |kFullScreenModeNormal|. This 70 // window is not on the primary screen, this should always be
68 // value can get out of sync with the correct state if we miss a notification 71 // |kFullScreenModeNormal|. This value can get out of sync with the correct
69 // (which can happen when a fullscreen window is closed). Used to track the 72 // state if we miss a notification (which can happen when a window is closed).
70 // current state and make sure we properly restore the menu bar when this 73 // Used to track the current state and make sure we properly restore the menu
71 // controller is destroyed. 74 // bar when this controller is destroyed.
72 base::mac::FullScreenMode currentFullscreenMode_; 75 base::mac::FullScreenMode systemFullscreenMode_;
73 } 76 }
74 77
75 @property(readonly, nonatomic) BOOL isFullscreen; 78 @property(readonly, nonatomic) BOOL inPresentationMode;
76 79
77 // Designated initializer. 80 // Designated initializer.
78 - (id)initWithBrowserController:(BrowserWindowController*)controller; 81 - (id)initWithBrowserController:(BrowserWindowController*)controller;
79 82
80 // Informs the controller that the browser has entered or exited fullscreen 83 // Informs the controller that the browser has entered or exited presentation
81 // mode. |-enterFullscreenForContentView:showDropdown:| should be called after 84 // mode. |-enterPresentationModeForContentView:showDropdown:| should be called
82 // the fullscreen window is setup, just before it is shown. |-exitFullscreen| 85 // after the window is setup, just before it is shown. |-exitPresentationMode|
83 // should be called before any views are moved back to the non-fullscreen 86 // should be called before any views are moved back to the non-fullscreen
84 // window. If |-enterFullscreenForContentView:showDropdown:| is called, it must 87 // window. If |-enterPresentationModeForContentView:showDropdown:| is called,
85 // be followed with a call to |-exitFullscreen| before the controller is 88 // it must be balanced with a call to |-exitPresentationMode| before the
86 // released. 89 // controller is released.
87 - (void)enterFullscreenForContentView:(NSView*)contentView 90 - (void)enterPresentationModeForContentView:(NSView*)contentView
88 showDropdown:(BOOL)showDropdown; 91 showDropdown:(BOOL)showDropdown;
89 - (void)exitFullscreen; 92 - (void)exitPresentationMode;
90 93
91 // Returns the amount by which the floating bar should be offset downwards (to 94 // Returns the amount by which the floating bar should be offset downwards (to
92 // avoid the menu) and by which the overlay view should be enlarged vertically. 95 // avoid the menu) and by which the overlay view should be enlarged vertically.
93 // Generally, this is > 0 when the fullscreen window is on the primary screen 96 // Generally, this is > 0 when the window is on the primary screen and 0
94 // and 0 otherwise. 97 // otherwise.
95 - (CGFloat)floatingBarVerticalOffset; 98 - (CGFloat)floatingBarVerticalOffset;
96 99
97 // Informs the controller that the overlay's frame has changed. The controller 100 // Informs the controller that the overlay's frame has changed. The controller
98 // uses this information to update its tracking areas. 101 // uses this information to update its tracking areas.
99 - (void)overlayFrameChanged:(NSRect)frame; 102 - (void)overlayFrameChanged:(NSRect)frame;
100 103
101 // Informs the controller that the overlay should be shown/hidden, possibly with 104 // Informs the controller that the overlay should be shown/hidden, possibly with
102 // animation, possibly after a delay (only applicable for the animated case). 105 // animation, possibly after a delay (only applicable for the animated case).
103 - (void)ensureOverlayShownWithAnimation:(BOOL)animate delay:(BOOL)delay; 106 - (void)ensureOverlayShownWithAnimation:(BOOL)animate delay:(BOOL)delay;
104 - (void)ensureOverlayHiddenWithAnimation:(BOOL)animate delay:(BOOL)delay; 107 - (void)ensureOverlayHiddenWithAnimation:(BOOL)animate delay:(BOOL)delay;
105 108
106 // Cancels any running animation and timers. 109 // Cancels any running animation and timers.
107 - (void)cancelAnimationAndTimers; 110 - (void)cancelAnimationAndTimers;
108 111
109 // Gets the current floating bar shown fraction. 112 // Gets the current floating bar shown fraction.
110 - (CGFloat)floatingBarShownFraction; 113 - (CGFloat)floatingBarShownFraction;
111 114
112 // Sets a new current floating bar shown fraction. NOTE: This function has side 115 // Sets a new current floating bar shown fraction. NOTE: This function has side
113 // effects, such as modifying the fullscreen mode (menu bar shown state). 116 // effects, such as modifying the system fullscreen mode (menu bar shown state).
114 - (void)changeFloatingBarShownFraction:(CGFloat)fraction; 117 - (void)changeFloatingBarShownFraction:(CGFloat)fraction;
115 118
116 @end 119 @end
117 120
118 // Notification posted when we're about to enter or leave fullscreen. 121 // Notification posted when we're about to enter or leave fullscreen.
119 extern NSString* const kWillEnterFullscreenNotification; 122 extern NSString* const kWillEnterFullscreenNotification;
120 extern NSString* const kWillLeaveFullscreenNotification; 123 extern NSString* const kWillLeaveFullscreenNotification;
121 124
122 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_CONTROLLER_H_ 125 #endif // CHROME_BROWSER_UI_COCOA_PRESENTATION_MODE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698