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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_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) 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 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 // A class acting as the Objective-C controller for the Browser 9 // A class acting as the Objective-C controller for the Browser
10 // object. Handles interactions between Cocoa and the cross-platform 10 // object. Handles interactions between Cocoa and the cross-platform
(...skipping 17 matching lines...) Expand all
28 #include "ui/gfx/rect.h" 28 #include "ui/gfx/rect.h"
29 29
30 @class AvatarButton; 30 @class AvatarButton;
31 class Browser; 31 class Browser;
32 class BrowserWindow; 32 class BrowserWindow;
33 class BrowserWindowCocoa; 33 class BrowserWindowCocoa;
34 class ConstrainedWindowMac; 34 class ConstrainedWindowMac;
35 @class DevToolsController; 35 @class DevToolsController;
36 @class DownloadShelfController; 36 @class DownloadShelfController;
37 @class FindBarCocoaController; 37 @class FindBarCocoaController;
38 @class FullscreenController; 38 @class FullscreenWindow;
39 @class GTMWindowSheetController; 39 @class GTMWindowSheetController;
40 @class InfoBarContainerController; 40 @class InfoBarContainerController;
41 class LocationBarViewMac; 41 class LocationBarViewMac;
42 @class PresentationModeController;
42 @class PreviewableContentsController; 43 @class PreviewableContentsController;
43 @class SidebarController; 44 @class SidebarController;
44 class StatusBubbleMac; 45 class StatusBubbleMac;
45 class TabContents; 46 class TabContents;
46 @class TabStripController; 47 @class TabStripController;
47 @class TabStripView; 48 @class TabStripView;
48 @class ToolbarController; 49 @class ToolbarController;
49 50
50 @interface BrowserWindowController : 51 @interface BrowserWindowController :
51 TabWindowController<NSUserInterfaceValidations, 52 TabWindowController<NSUserInterfaceValidations,
(...skipping 12 matching lines...) Expand all
64 scoped_ptr<BrowserWindowCocoa> windowShim_; 65 scoped_ptr<BrowserWindowCocoa> windowShim_;
65 scoped_nsobject<ToolbarController> toolbarController_; 66 scoped_nsobject<ToolbarController> toolbarController_;
66 scoped_nsobject<TabStripController> tabStripController_; 67 scoped_nsobject<TabStripController> tabStripController_;
67 scoped_nsobject<FindBarCocoaController> findBarCocoaController_; 68 scoped_nsobject<FindBarCocoaController> findBarCocoaController_;
68 scoped_nsobject<InfoBarContainerController> infoBarContainerController_; 69 scoped_nsobject<InfoBarContainerController> infoBarContainerController_;
69 scoped_nsobject<DownloadShelfController> downloadShelfController_; 70 scoped_nsobject<DownloadShelfController> downloadShelfController_;
70 scoped_nsobject<BookmarkBarController> bookmarkBarController_; 71 scoped_nsobject<BookmarkBarController> bookmarkBarController_;
71 scoped_nsobject<DevToolsController> devToolsController_; 72 scoped_nsobject<DevToolsController> devToolsController_;
72 scoped_nsobject<SidebarController> sidebarController_; 73 scoped_nsobject<SidebarController> sidebarController_;
73 scoped_nsobject<PreviewableContentsController> previewableContentsController_; 74 scoped_nsobject<PreviewableContentsController> previewableContentsController_;
74 scoped_nsobject<FullscreenController> fullscreenController_; 75 scoped_nsobject<PresentationModeController> presentationModeController_;
75 76
76 // Strong. StatusBubble is a special case of a strong reference that 77 // Strong. StatusBubble is a special case of a strong reference that
77 // we don't wrap in a scoped_ptr because it is acting the same 78 // we don't wrap in a scoped_ptr because it is acting the same
78 // as an NSWindowController in that it wraps a window that must 79 // as an NSWindowController in that it wraps a window that must
79 // be shut down before our destructors are called. 80 // be shut down before our destructors are called.
80 StatusBubbleMac* statusBubble_; 81 StatusBubbleMac* statusBubble_;
81 82
82 BookmarkBubbleController* bookmarkBubbleController_; // Weak. 83 BookmarkBubbleController* bookmarkBubbleController_; // Weak.
83 BOOL initializing_; // YES while we are currently in initWithBrowser: 84 BOOL initializing_; // YES while we are currently in initWithBrowser:
84 BOOL ownsBrowser_; // Only ever NO when testing 85 BOOL ownsBrowser_; // Only ever NO when testing
(...skipping 19 matching lines...) Expand all
104 // The raw accumulated zoom value and the actual zoom increments made for an 105 // The raw accumulated zoom value and the actual zoom increments made for an
105 // an in-progress pinch gesture. 106 // an in-progress pinch gesture.
106 CGFloat totalMagnifyGestureAmount_; 107 CGFloat totalMagnifyGestureAmount_;
107 NSInteger currentZoomStepDelta_; 108 NSInteger currentZoomStepDelta_;
108 109
109 // The view that shows the incognito badge or the multi-profile avatar icon. 110 // The view that shows the incognito badge or the multi-profile avatar icon.
110 // Nil if neither is present. Needed to access the view to move it to/from the 111 // Nil if neither is present. Needed to access the view to move it to/from the
111 // fullscreen window. 112 // fullscreen window.
112 scoped_nsobject<AvatarButton> avatarButton_; 113 scoped_nsobject<AvatarButton> avatarButton_;
113 114
115 // The view that shows the presentation mode toggle when in Lion fullscreen
116 // mode. Nil if not in fullscreen mode or not on Lion.
117 scoped_nsobject<NSButton> presentationModeToggleButton_;
118
114 // Lazily created view which draws the background for the floating set of bars 119 // Lazily created view which draws the background for the floating set of bars
115 // in fullscreen mode (for window types having a floating bar; it remains nil 120 // in presentation mode (for window types having a floating bar; it remains
116 // for those which don't). 121 // nil for those which don't).
117 scoped_nsobject<NSView> floatingBarBackingView_; 122 scoped_nsobject<NSView> floatingBarBackingView_;
118 123
119 // Tracks whether the floating bar is above or below the bookmark bar, in 124 // Tracks whether the floating bar is above or below the bookmark bar, in
120 // terms of z-order. 125 // terms of z-order.
121 BOOL floatingBarAboveBookmarkBar_; 126 BOOL floatingBarAboveBookmarkBar_;
122 127
123 // The proportion of the floating bar which is shown (in fullscreen mode). 128 // The borderless window used in fullscreen mode. Lion reuses the original
129 // window in fullscreen mode, so this is always nil on Lion.
130 scoped_nsobject<NSWindow> fullscreenWindow_;
131
132 // Tracks whether presentation mode was entered from fullscreen mode or
133 // directly from normal windowed mode. Used to determine what to do when
134 // exiting presentation mode.
135 BOOL enteredPresentationModeFromFullscreen_;
136
137 // The size of the original (non-fullscreen) window. This is saved just
138 // before entering fullscreen mode and is only valid when |-isFullscreen|
139 // returns YES.
140 NSRect savedRegularWindowFrame_;
141
142 // The proportion of the floating bar which is shown (in presentation mode).
124 CGFloat floatingBarShownFraction_; 143 CGFloat floatingBarShownFraction_;
125 144
126 // Various UI elements/events may want to ensure that the floating bar is 145 // Various UI elements/events may want to ensure that the floating bar is
127 // visible (in fullscreen mode), e.g., because of where the mouse is or where 146 // visible (in presentation mode), e.g., because of where the mouse is or
128 // keyboard focus is. Whenever an object requires bar visibility, it has 147 // where keyboard focus is. Whenever an object requires bar visibility, it has
129 // itself added to |barVisibilityLocks_|. When it no longer requires bar 148 // itself added to |barVisibilityLocks_|. When it no longer requires bar
130 // visibility, it has itself removed. 149 // visibility, it has itself removed.
131 scoped_nsobject<NSMutableSet> barVisibilityLocks_; 150 scoped_nsobject<NSMutableSet> barVisibilityLocks_;
132 151
133 // Bar visibility locks and releases only result (when appropriate) in changes 152 // Bar visibility locks and releases only result (when appropriate) in changes
134 // in visible state when the following is |YES|. 153 // in visible state when the following is |YES|.
135 BOOL barVisibilityUpdatesEnabled_; 154 BOOL barVisibilityUpdatesEnabled_;
136 } 155 }
137 156
138 // A convenience class method which gets the |BrowserWindowController| for a 157 // A convenience class method which gets the |BrowserWindowController| for a
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 311
293 // Called when the Add Search Engine dialog is closed. 312 // Called when the Add Search Engine dialog is closed.
294 - (void)sheetDidEnd:(NSWindow*)sheet 313 - (void)sheetDidEnd:(NSWindow*)sheet
295 returnCode:(NSInteger)code 314 returnCode:(NSInteger)code
296 context:(void*)context; 315 context:(void*)context;
297 316
298 @end // @interface BrowserWindowController 317 @end // @interface BrowserWindowController
299 318
300 319
301 // Methods having to do with the window type (normal/popup/app, and whether the 320 // Methods having to do with the window type (normal/popup/app, and whether the
302 // window has various features; fullscreen methods are separate). 321 // window has various features; fullscreen and presentation mode methods are
322 // separate).
303 @interface BrowserWindowController(WindowType) 323 @interface BrowserWindowController(WindowType)
304 324
305 // Determines whether this controller's window supports a given feature (i.e., 325 // Determines whether this controller's window supports a given feature (i.e.,
306 // whether a given feature is or can be shown in the window). 326 // whether a given feature is or can be shown in the window).
307 // TODO(viettrungluu): |feature| is really should be |Browser::Feature|, but I 327 // TODO(viettrungluu): |feature| is really should be |Browser::Feature|, but I
308 // don't want to include browser.h (and you can't forward declare enums). 328 // don't want to include browser.h (and you can't forward declare enums).
309 - (BOOL)supportsWindowFeature:(int)feature; 329 - (BOOL)supportsWindowFeature:(int)feature;
310 330
311 // Called to check whether or not this window has a normal title bar (YES if it 331 // Called to check whether or not this window has a normal title bar (YES if it
312 // does, NO otherwise). (E.g., normal browser windows do not, pop-ups do.) 332 // does, NO otherwise). (E.g., normal browser windows do not, pop-ups do.)
(...skipping 14 matching lines...) Expand all
327 347
328 // Called to check if this controller's window is a tabbed window (e.g., not a 348 // Called to check if this controller's window is a tabbed window (e.g., not a
329 // pop-up window). Returns YES if it is, NO otherwise. 349 // pop-up window). Returns YES if it is, NO otherwise.
330 // Note: The |-has...| methods are usually preferred, so this method is largely 350 // Note: The |-has...| methods are usually preferred, so this method is largely
331 // deprecated. 351 // deprecated.
332 - (BOOL)isTabbedWindow; 352 - (BOOL)isTabbedWindow;
333 353
334 @end // @interface BrowserWindowController(WindowType) 354 @end // @interface BrowserWindowController(WindowType)
335 355
336 356
337 // Methods having to do with fullscreen mode. 357 // Methods having to do with fullscreen and presentation mode.
338 @interface BrowserWindowController(Fullscreen) 358 @interface BrowserWindowController(Fullscreen)
339 359
340 // Enters fullscreen mode. 360 // Toggles fullscreen mode. Meant to be called by Lion windows when they enter
341 - (IBAction)enterFullscreen:(id)sender; 361 // or exit Lion fullscreen mode. Must not be called on Snow Leopard or earlier.
362 - (void)handleLionToggleFullscreen;
342 363
343 // Enters (or exits) fullscreen mode. 364 // Enters (or exits) fullscreen mode. This method is safe to call on all OS
365 // versions.
344 - (void)setFullscreen:(BOOL)fullscreen; 366 - (void)setFullscreen:(BOOL)fullscreen;
345 367
346 // Returns fullscreen state. 368 // Returns fullscreen state. This method is safe to call on all OS versions.
347 - (BOOL)isFullscreen; 369 - (BOOL)isFullscreen;
348 370
371 // Toggles presentation mode without exiting fullscreen mode. Should only be
372 // called by the presentation mode toggle button. This method should not be
373 // called on Snow Leopard or earlier.
374 - (void)togglePresentationModeForLionOrLater:(id)sender;
375
376 // Enters (or exits) presentation mode. Also enters fullscreen mode if this
377 // window is not already fullscreen. This method is safe to call on all OS
378 // versions.
379 - (void)setPresentationMode:(BOOL)presentationMode;
380
381 // Returns presentation mode state. This method is safe to call on all OS
382 // versions.
383 - (BOOL)inPresentationMode;
384
349 // Resizes the fullscreen window to fit the screen it's currently on. Called by 385 // Resizes the fullscreen window to fit the screen it's currently on. Called by
350 // the FullscreenController when there is a change in monitor placement or 386 // the PresentationModeController when there is a change in monitor placement or
351 // resolution. 387 // resolution.
352 - (void)resizeFullscreenWindow; 388 - (void)resizeFullscreenWindow;
353 389
354 // Gets or sets the fraction of the floating bar (fullscreen overlay) that is 390 // Gets or sets the fraction of the floating bar (presentation mode overlay)
355 // shown. 0 is completely hidden, 1 is fully shown. 391 // that is shown. 0 is completely hidden, 1 is fully shown.
356 - (CGFloat)floatingBarShownFraction; 392 - (CGFloat)floatingBarShownFraction;
357 - (void)setFloatingBarShownFraction:(CGFloat)fraction; 393 - (void)setFloatingBarShownFraction:(CGFloat)fraction;
358 394
359 // Query/lock/release the requirement that the tab strip/toolbar/attached 395 // Query/lock/release the requirement that the tab strip/toolbar/attached
360 // bookmark bar bar cluster is visible (e.g., when one of its elements has 396 // bookmark bar bar cluster is visible (e.g., when one of its elements has
361 // focus). This is required for the floating bar in fullscreen mode, but should 397 // focus). This is required for the floating bar in presentation mode, but
362 // also be called when not in fullscreen mode; see the comments for 398 // should also be called when not in presentation mode; see the comments for
363 // |barVisibilityLocks_| for more details. Double locks/releases by the same 399 // |barVisibilityLocks_| for more details. Double locks/releases by the same
364 // owner are ignored. If |animate:| is YES, then an animation may be performed, 400 // owner are ignored. If |animate:| is YES, then an animation may be performed,
365 // possibly after a small delay if |delay:| is YES. If |animate:| is NO, 401 // possibly after a small delay if |delay:| is YES. If |animate:| is NO,
366 // |delay:| will be ignored. In the case of multiple calls, later calls have 402 // |delay:| will be ignored. In the case of multiple calls, later calls have
367 // precedence with the rule that |animate:NO| has precedence over |animate:YES|, 403 // precedence with the rule that |animate:NO| has precedence over |animate:YES|,
368 // and |delay:NO| has precedence over |delay:YES|. 404 // and |delay:NO| has precedence over |delay:YES|.
369 - (BOOL)isBarVisibilityLockedForOwner:(id)owner; 405 - (BOOL)isBarVisibilityLockedForOwner:(id)owner;
370 - (void)lockBarVisibilityForOwner:(id)owner 406 - (void)lockBarVisibilityForOwner:(id)owner
371 withAnimation:(BOOL)animate 407 withAnimation:(BOOL)animate
372 delay:(BOOL)delay; 408 delay:(BOOL)delay;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 - (void)resetWindowGrowthState; 447 - (void)resetWindowGrowthState;
412 448
413 // Computes by how far in each direction, horizontal and vertical, the 449 // Computes by how far in each direction, horizontal and vertical, the
414 // |source| rect doesn't fit into |target|. 450 // |source| rect doesn't fit into |target|.
415 - (NSSize)overflowFrom:(NSRect)source 451 - (NSSize)overflowFrom:(NSRect)source
416 to:(NSRect)target; 452 to:(NSRect)target;
417 @end // @interface BrowserWindowController (TestingAPI) 453 @end // @interface BrowserWindowController (TestingAPI)
418 454
419 455
420 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_ 456 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.mm ('k') | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698