Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / browser_window_controller.h
blob54e759daa532d2a71061c61944e2f77491b7cf52
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_
8 // A class acting as the Objective-C controller for the Browser
9 // object. Handles interactions between Cocoa and the cross-platform
10 // code. Each window has a single toolbar and, by virtue of being a
11 // TabWindowController, a tab strip along the top.
13 #import <Cocoa/Cocoa.h>
15 #include "base/mac/scoped_nsobject.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "chrome/browser/translate/chrome_translate_client.h"
18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h"
20 #import "chrome/browser/ui/cocoa/browser_command_executor.h"
21 #import "chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h"
22 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
23 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h"
24 #import "chrome/browser/ui/cocoa/themed_window.h"
25 #import "chrome/browser/ui/cocoa/url_drop_target.h"
26 #import "chrome/browser/ui/cocoa/view_resizer.h"
27 #include "components/translate/core/common/translate_errors.h"
28 #include "ui/base/accelerators/accelerator_manager.h"
29 #include "ui/gfx/geometry/rect.h"
31 @class AvatarBaseController;
32 class Browser;
33 class BrowserWindow;
34 class BrowserWindowCocoa;
35 @class BrowserWindowEnterFullscreenTransition;
36 @class DevToolsController;
37 @class DownloadShelfController;
38 class ExtensionKeybindingRegistryCocoa;
39 @class FindBarCocoaController;
40 @class FullscreenModeController;
41 @class FullscreenWindow;
42 @class InfoBarContainerController;
43 class LocationBarViewMac;
44 @class OverlayableContentsController;
45 class PermissionBubbleCocoa;
46 @class PresentationModeController;
47 class StatusBubbleMac;
48 @class TabStripController;
49 @class TabStripView;
50 @class ToolbarController;
51 @class TranslateBubbleController;
53 namespace content {
54 class WebContents;
57 namespace extensions {
58 class Command;
61 @interface BrowserWindowController :
62 TabWindowController<NSUserInterfaceValidations,
63 BookmarkBarControllerDelegate,
64 BrowserCommandExecutor,
65 ViewResizer,
66 TabStripControllerDelegate> {
67 @private
68 // The ordering of these members is important as it determines the order in
69 // which they are destroyed. |browser_| needs to be destroyed last as most of
70 // the other objects hold weak references to it or things it owns
71 // (tab/toolbar/bookmark models, profiles, etc).
72 scoped_ptr<Browser> browser_;
73 NSWindow* savedRegularWindow_;
74 scoped_ptr<BrowserWindowCocoa> windowShim_;
75 base::scoped_nsobject<ToolbarController> toolbarController_;
76 base::scoped_nsobject<TabStripController> tabStripController_;
77 base::scoped_nsobject<FindBarCocoaController> findBarCocoaController_;
78 base::scoped_nsobject<InfoBarContainerController> infoBarContainerController_;
79 base::scoped_nsobject<DownloadShelfController> downloadShelfController_;
80 base::scoped_nsobject<BookmarkBarController> bookmarkBarController_;
81 base::scoped_nsobject<DevToolsController> devToolsController_;
82 base::scoped_nsobject<OverlayableContentsController>
83 overlayableContentsController_;
84 base::scoped_nsobject<PresentationModeController> presentationModeController_;
85 base::scoped_nsobject<ExclusiveAccessBubbleWindowController>
86 exclusiveAccessBubbleWindowController_;
87 base::scoped_nsobject<BrowserWindowEnterFullscreenTransition>
88 enterFullscreenTransition_;
90 // Strong. StatusBubble is a special case of a strong reference that
91 // we don't wrap in a scoped_ptr because it is acting the same
92 // as an NSWindowController in that it wraps a window that must
93 // be shut down before our destructors are called.
94 StatusBubbleMac* statusBubble_;
96 BookmarkBubbleController* bookmarkBubbleController_; // Weak.
97 BOOL initializing_; // YES while we are currently in initWithBrowser:
98 BOOL ownsBrowser_; // Only ever NO when testing
100 TranslateBubbleController* translateBubbleController_; // Weak.
102 // The total amount by which we've grown the window up or down (to display a
103 // bookmark bar and/or download shelf), respectively; reset to 0 when moved
104 // away from the bottom/top or resized (or zoomed).
105 CGFloat windowTopGrowth_;
106 CGFloat windowBottomGrowth_;
108 // YES only if we're shrinking the window from an apparent zoomed state (which
109 // we'll only do if we grew it to the zoomed state); needed since we'll then
110 // restrict the amount of shrinking by the amounts specified above. Reset to
111 // NO on growth.
112 BOOL isShrinkingFromZoomed_;
114 // The view controller that manages the incognito badge or the multi-profile
115 // avatar button. Depending on whether the --new-profile-management flag is
116 // used, the multi-profile button can either be the avatar's icon badge or a
117 // button with the profile's name. If the flag is used, the button is always
118 // shown, otherwise the view will always be in the view hierarchy but will
119 // be hidden unless it's appropriate to show it (i.e. if there's more than
120 // one profile).
121 base::scoped_nsobject<AvatarBaseController> avatarButtonController_;
123 // Lazily created view which draws the background for the floating set of bars
124 // in presentation mode (for window types having a floating bar; it remains
125 // nil for those which don't).
126 base::scoped_nsobject<NSView> floatingBarBackingView_;
128 // The borderless window used in fullscreen mode when Cocoa's System
129 // Fullscreen API is not being used (or not available, before OS 10.7).
130 base::scoped_nsobject<NSWindow> fullscreenWindow_;
132 // The Cocoa implementation of the PermissionBubbleView.
133 scoped_ptr<PermissionBubbleCocoa> permissionBubbleCocoa_;
135 // True between |-windowWillEnterFullScreen:| and |-windowDidEnterFullScreen:|
136 // to indicate that the window is in the process of transitioning into
137 // AppKit fullscreen mode.
138 BOOL enteringAppKitFullscreen_;
140 // True between |enterImmersiveFullscreen| and |-windowDidEnterFullScreen:|
141 // to indicate that the window is in the process of transitioning into
142 // AppKit fullscreen mode.
143 BOOL enteringImmersiveFullscreen_;
145 // True between |-setPresentationMode:url:bubbleType:| and
146 // |-windowDidEnterFullScreen:| to indicate that the window is in the process
147 // of transitioning into fullscreen presentation mode.
148 BOOL enteringPresentationMode_;
150 // When the window is in the process of entering AppKit Fullscreen, this
151 // property indicates whether the window is being fullscreened on the
152 // primary screen.
153 BOOL enteringAppKitFullscreenOnPrimaryScreen_;
155 // The size of the original (non-fullscreen) window. This is saved just
156 // before entering fullscreen mode and is only valid when |-isFullscreen|
157 // returns YES.
158 NSRect savedRegularWindowFrame_;
160 // The proportion of the floating bar which is shown (in presentation mode).
161 CGFloat floatingBarShownFraction_;
163 // Various UI elements/events may want to ensure that the floating bar is
164 // visible (in presentation mode), e.g., because of where the mouse is or
165 // where keyboard focus is. Whenever an object requires bar visibility, it has
166 // itself added to |barVisibilityLocks_|. When it no longer requires bar
167 // visibility, it has itself removed.
168 base::scoped_nsobject<NSMutableSet> barVisibilityLocks_;
170 // Bar visibility locks and releases only result (when appropriate) in changes
171 // in visible state when the following is |YES|.
172 BOOL barVisibilityUpdatesEnabled_;
174 // When going fullscreen for a tab, we need to store the URL and the
175 // fullscreen type, since we can't show the bubble until
176 // -windowDidEnterFullScreen: gets called.
177 GURL fullscreenUrl_;
178 ExclusiveAccessBubbleType exclusiveAccessBubbleType_;
180 // The Extension Command Registry used to determine which keyboard events to
181 // handle.
182 scoped_ptr<ExtensionKeybindingRegistryCocoa> extension_keybinding_registry_;
184 // Whether the root view of the window is layer backed.
185 BOOL windowViewWantsLayer_;
188 // A convenience class method which gets the |BrowserWindowController| for a
189 // given window. This method returns nil if no window in the chain has a BWC.
190 + (BrowserWindowController*)browserWindowControllerForWindow:(NSWindow*)window;
192 // A convenience class method which gets the |BrowserWindowController| for a
193 // given view. This is the controller for the window containing |view|, if it
194 // is a BWC, or the first controller in the parent-window chain that is a
195 // BWC. This method returns nil if no window in the chain has a BWC.
196 + (BrowserWindowController*)browserWindowControllerForView:(NSView*)view;
198 // Load the browser window nib and do any Cocoa-specific initialization.
199 // Takes ownership of |browser|.
200 - (id)initWithBrowser:(Browser*)browser;
202 // Call to make the browser go away from other places in the cross-platform
203 // code.
204 - (void)destroyBrowser;
206 // Ensure bounds for the window abide by the minimum window size.
207 - (gfx::Rect)enforceMinWindowSize:(gfx::Rect)bounds;
209 // Access the C++ bridge between the NSWindow and the rest of Chromium.
210 - (BrowserWindow*)browserWindow;
212 // Return a weak pointer to the toolbar controller.
213 - (ToolbarController*)toolbarController;
215 // Return a weak pointer to the tab strip controller.
216 - (TabStripController*)tabStripController;
218 // Return a weak pointer to the find bar controller.
219 - (FindBarCocoaController*)findBarCocoaController;
221 // Access the ObjC controller that contains the infobars.
222 - (InfoBarContainerController*)infoBarContainerController;
224 // Access the C++ bridge object representing the status bubble for the window.
225 - (StatusBubbleMac*)statusBubble;
227 // Access the C++ bridge object representing the location bar.
228 - (LocationBarViewMac*)locationBarBridge;
230 // Returns a weak pointer to the floating bar backing view;
231 - (NSView*)floatingBarBackingView;
233 // Returns a weak pointer to the overlayable contents controller.
234 - (OverlayableContentsController*)overlayableContentsController;
236 // Access the Profile object that backs this Browser.
237 - (Profile*)profile;
239 // Access the avatar button controller.
240 - (AvatarBaseController*)avatarButtonController;
242 // Forces the toolbar (and transitively the location bar) to update its current
243 // state. If |tab| is non-NULL, we're switching (back?) to this tab and should
244 // restore any previous location bar state (such as user editing) as well.
245 - (void)updateToolbarWithContents:(content::WebContents*)tab;
247 // Resets the toolbar's tab state for |tab|.
248 - (void)resetTabState:(content::WebContents*)tab;
250 // Sets whether or not the current page in the frontmost tab is bookmarked.
251 - (void)setStarredState:(BOOL)isStarred;
253 // Sets whether or not the current page is translated.
254 - (void)setCurrentPageIsTranslated:(BOOL)on;
256 // Invoked via BrowserWindowCocoa::OnActiveTabChanged, happens whenever a
257 // new tab becomes active.
258 - (void)onActiveTabChanged:(content::WebContents*)oldContents
259 to:(content::WebContents*)newContents;
261 // Happens when the zoom level is changed in the active tab, the active tab is
262 // changed, or a new browser window or tab is created. |canShowBubble| denotes
263 // whether it would be appropriate to show a zoom bubble or not.
264 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble;
266 // Return the rect, in WebKit coordinates (flipped), of the window's grow box
267 // in the coordinate system of the content area of the currently selected tab.
268 - (NSRect)selectedTabGrowBoxRect;
270 // Called to tell the selected tab to update its loading state.
271 // |force| is set if the update is due to changing tabs, as opposed to
272 // the page-load finishing. See comment in reload_button_cocoa.h.
273 - (void)setIsLoading:(BOOL)isLoading force:(BOOL)force;
275 // Brings this controller's window to the front.
276 - (void)activate;
278 // Make the location bar the first responder, if possible.
279 - (void)focusLocationBar:(BOOL)selectAll;
281 // Make the (currently-selected) tab contents the first responder, if possible.
282 - (void)focusTabContents;
284 // Returns the frame of the regular (non-fullscreened) window (even if the
285 // window is currently in fullscreen mode). The frame is returned in Cocoa
286 // coordinates (origin in bottom-left).
287 - (NSRect)regularWindowFrame;
289 // Whether or not to show the avatar, which is either the incognito guy or the
290 // user's profile avatar.
291 - (BOOL)shouldShowAvatar;
293 // Whether or not to show the new avatar button used by --new-profile-maagement.
294 - (BOOL)shouldUseNewAvatarButton;
296 - (BOOL)isBookmarkBarVisible;
298 // Returns YES if the bookmark bar is currently animating.
299 - (BOOL)isBookmarkBarAnimating;
301 - (BookmarkBarController*)bookmarkBarController;
303 - (DevToolsController*)devToolsController;
305 - (BOOL)isDownloadShelfVisible;
307 // Lazily creates the download shelf in visible state if it doesn't exist yet.
308 - (void)createAndAddDownloadShelf;
310 // Returns the download shelf controller, if it exists.
311 - (DownloadShelfController*)downloadShelf;
313 // Retains the given FindBarCocoaController and adds its view to this
314 // browser window. Must only be called once per
315 // BrowserWindowController.
316 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController;
318 // The user changed the theme.
319 - (void)userChangedTheme;
321 // Executes the command in the context of the current browser.
322 // |command| is an integer value containing one of the constants defined in the
323 // "chrome/app/chrome_command_ids.h" file.
324 - (void)executeCommand:(int)command;
326 // Consults the Command Registry to see if this |event| needs to be handled as
327 // an extension command and returns YES if so (NO otherwise).
328 // Only extensions with the given |priority| are considered.
329 - (BOOL)handledByExtensionCommand:(NSEvent*)event
330 priority:(ui::AcceleratorManager::HandlerPriority)priority;
332 // Delegate method for the status bubble to query its base frame.
333 - (NSRect)statusBubbleBaseFrame;
335 // Show the bookmark bubble (e.g. user just clicked on the STAR)
336 - (void)showBookmarkBubbleForURL:(const GURL&)url
337 alreadyBookmarked:(BOOL)alreadyBookmarked;
339 // Show the translate bubble.
340 - (void)showTranslateBubbleForWebContents:(content::WebContents*)contents
341 step:(translate::TranslateStep)step
342 errorType:
343 (translate::TranslateErrors::Type)errorType;
345 // Dismiss the permission bubble
346 - (void)dismissPermissionBubble;
348 // Shows or hides the docked web inspector depending on |contents|'s state.
349 - (void)updateDevToolsForContents:(content::WebContents*)contents;
351 // Gets the current theme provider.
352 - (ui::ThemeProvider*)themeProvider;
354 // Gets the window style.
355 - (ThemedWindowStyle)themedWindowStyle;
357 // Returns the position in window coordinates that the top left of a theme
358 // image with |alignment| should be painted at. If the window does not have a
359 // tab strip, the offset for THEME_IMAGE_ALIGN_WITH_FRAME is always returned.
360 // The result of this method can be used in conjunction with
361 // [NSGraphicsContext cr_setPatternPhase:] to set the offset of pattern colors.
362 - (NSPoint)themeImagePositionForAlignment:(ThemeImageAlignment)alignment;
364 // Return the point to which a bubble window's arrow should point, in window
365 // coordinates.
366 - (NSPoint)bookmarkBubblePoint;
368 // Called when the Add Search Engine dialog is closed.
369 - (void)sheetDidEnd:(NSWindow*)sheet
370 returnCode:(NSInteger)code
371 context:(void*)context;
373 // Executes the command registered by the extension that has the given id.
374 - (void)executeExtensionCommand:(const std::string&)extension_id
375 command:(const extensions::Command&)command;
377 @end // @interface BrowserWindowController
380 // Methods having to do with the window type (normal/popup/app, and whether the
381 // window has various features; fullscreen and presentation mode methods are
382 // separate).
383 @interface BrowserWindowController(WindowType)
385 // Determines whether this controller's window supports a given feature (i.e.,
386 // whether a given feature is or can be shown in the window).
387 // TODO(viettrungluu): |feature| is really should be |Browser::Feature|, but I
388 // don't want to include browser.h (and you can't forward declare enums).
389 - (BOOL)supportsWindowFeature:(int)feature;
391 // Called to check whether or not this window has a normal title bar (YES if it
392 // does, NO otherwise). (E.g., normal browser windows do not, pop-ups do.)
393 - (BOOL)hasTitleBar;
395 // Called to check whether or not this window has a toolbar (YES if it does, NO
396 // otherwise). (E.g., normal browser windows do, pop-ups do not.)
397 - (BOOL)hasToolbar;
399 // Called to check whether or not this window has a location bar (YES if it
400 // does, NO otherwise). (E.g., normal browser windows do, pop-ups may or may
401 // not.)
402 - (BOOL)hasLocationBar;
404 // Called to check whether or not this window can have bookmark bar (YES if it
405 // does, NO otherwise). (E.g., normal browser windows may, pop-ups may not.)
406 - (BOOL)supportsBookmarkBar;
408 // Called to check if this controller's window is a tabbed window (e.g., not a
409 // pop-up window). Returns YES if it is, NO otherwise.
410 // Note: The |-has...| methods are usually preferred, so this method is largely
411 // deprecated.
412 - (BOOL)isTabbedWindow;
414 @end // @interface BrowserWindowController(WindowType)
416 // Fullscreen terminology:
418 // ----------------------------------------------------------------------------
419 // There are 2 APIs that cause the window to get resized, and possibly move
420 // spaces.
422 // + AppKitFullscreen API: AppKit touts a feature known as "fullscreen". This
423 // involves moving the current window to a different space, and resizing the
424 // window to take up the entire size of the screen.
426 // + Immersive fullscreen: An alternative to AppKitFullscreen API. Uses on 10.6
427 // (before AppKitFullscreen API was available), and on certain HTML/Flash
428 // content. This is a method defined by Chrome.
430 // The Immersive fullscreen API can be called after the AppKitFullscreen API.
431 // Calling the AppKitFullscreen API while immersive fullscreen API has been
432 // invoked causes all fullscreen modes to exit.
434 // ----------------------------------------------------------------------------
435 // There are 2 "styles" of omnibox sliding.
436 // + OMNIBOX_TABS_PRESENT: Both the omnibox and the tabstrip are present.
437 // Moving the cursor to the top causes the menubar to appear, and everything
438 // else to slide down.
439 // + OMNIBOX_TABS_HIDDEN: Both tabstrip and omnibox are hidden. Moving cursor
440 // to top shows tabstrip, omnibox, and menu bar.
442 // The omnibox sliding styles are used in conjunction with the fullscreen APIs.
443 // There is exactly 1 sliding style active at a time. The sliding is mangaged
444 // by the presentationModeController_. (poorly named).
446 // ----------------------------------------------------------------------------
447 // There are several "fullscreen modes" bantered around. Technically, any
448 // fullscreen API can be combined with any sliding style.
450 // + System fullscreen***deprecated***: This term is confusing. Don't use it.
451 // It either refers to the AppKitFullscreen API, or the behavior that users
452 // expect to see when they click the fullscreen button, or some Chrome specific
453 // implementation that uses the AppKitFullscreen API.
455 // + Canonical Fullscreen: When a user clicks on the fullscreen button, they
456 // expect a fullscreen behavior similar to other AppKit apps.
457 // - AppKitFullscreen API + OMNIBOX_TABS_PRESENT.
458 // - The button click directly invokes the AppKitFullscreen API. This class
459 // get a callback, and calls adjustUIForOmniboxFullscreen.
460 // - There is a menu item that is intended to invoke the same behavior. When
461 // the user clicks the menu item, or use its hotkey, this class invokes the
462 // AppKitFullscreen API.
464 // + Presentation Mode:
465 // - OMNIBOX_TABS_HIDDEN, typically with AppKitFullscreen API, but can
466 // also be with Immersive fullscreen API.
467 // - This class sets a flag, indicating that it wants Presentation Mode
468 // instead of Canonical Fullscreen. Then it invokes the AppKitFullscreen API.
470 // + HTML5 fullscreen. <-- Currently uses AppKitFullscreen API. This should
471 // eventually migrate to the Immersive Fullscreen API.
473 // There are more fullscreen styles on OSX than other OSes. However, all OSes
474 // share the same cross-platform code for entering fullscreen
475 // (FullscreenController). It is important for OSX fullscreen logic to track
476 // how the user triggered fullscreen mode.
477 // There are currently 5 possible mechanisms:
478 // - User clicks the AppKit Fullscreen button.
479 // -- This invokes -[BrowserWindowController windowWillEnterFullscreen:]
480 // - User selects the menu item "Enter Full Screen".
481 // -- This invokes FullscreenController::ToggleFullscreenModeInternal(
482 // BROWSER_WITH_CHROME)
483 // - User selects the menu item "Enter Presentation Mode".
484 // -- This invokes FullscreenController::ToggleFullscreenModeInternal(
485 // BROWSER)
486 // -- The corresponding URL will be empty.
487 // - User requests fullscreen via an extension.
488 // -- This invokes FullscreenController::ToggleFullscreenModeInternal(
489 // BROWSER)
490 // -- The corresponding URL will be the url of the extension.
491 // - User requests fullscreen via Flash or JavaScript apis.
492 // -- This invokes FullscreenController::ToggleFullscreenModeInternal(
493 // BROWSER)
494 // -- browser_->fullscreen_controller()->
495 // IsWindowFullscreenForTabOrPending() returns true.
496 // -- The corresponding URL will be the url of the web page.
498 // Methods having to do with fullscreen and presentation mode.
499 @interface BrowserWindowController(Fullscreen)
501 // Toggles fullscreen mode. Meant to be called by Lion windows when they enter
502 // or exit Lion fullscreen mode. Must not be called on Snow Leopard or earlier.
503 - (void)handleLionToggleFullscreen;
505 // Enters Browser/Appkit Fullscreen.
506 // If |withToolbar| is NO, the tab strip and toolbar are hidden
507 // (aka Presentation Mode).
508 - (void)enterBrowserFullscreenWithToolbar:(BOOL)withToolbar;
510 // Adds or removes the tab strip and toolbar from the current window. The
511 // window must be in immersive or AppKit Fullscreen.
512 - (void)updateFullscreenWithToolbar:(BOOL)withToolbar;
514 // Updates the contents of the fullscreen exit bubble with |url| and
515 // |bubbleType|.
516 - (void)updateFullscreenExitBubbleURL:(const GURL&)url
517 bubbleType:(ExclusiveAccessBubbleType)bubbleType;
519 // Returns YES if the browser window is in or entering any fullscreen mode.
520 - (BOOL)isInAnyFullscreenMode;
522 // Returns YES if the browser window is currently in or entering fullscreen via
523 // the built-in immersive mechanism.
524 - (BOOL)isInImmersiveFullscreen;
526 // Returns YES if the browser window is currently in or entering fullscreen via
527 // the AppKit Fullscreen API.
528 - (BOOL)isInAppKitFullscreen;
530 // Enter fullscreen for an extension.
531 - (void)enterExtensionFullscreenForURL:(const GURL&)url
532 bubbleType:(ExclusiveAccessBubbleType)bubbleType;
534 // Enters Immersive Fullscreen for the given URL.
535 - (void)enterWebContentFullscreenForURL:(const GURL&)url
536 bubbleType:(ExclusiveAccessBubbleType)bubbleType;
538 // Exits the current fullscreen mode.
539 - (void)exitAnyFullscreen;
541 // Whether the system is in the very specific fullscreen mode: Presentation
542 // Mode.
543 - (BOOL)inPresentationMode;
545 // Resizes the fullscreen window to fit the screen it's currently on. Called by
546 // the PresentationModeController when there is a change in monitor placement or
547 // resolution.
548 - (void)resizeFullscreenWindow;
550 // Query/lock/release the requirement that the tab strip/toolbar/attached
551 // bookmark bar bar cluster is visible (e.g., when one of its elements has
552 // focus). This is required for the floating bar in presentation mode, but
553 // should also be called when not in presentation mode; see the comments for
554 // |barVisibilityLocks_| for more details. Double locks/releases by the same
555 // owner are ignored. If |animate:| is YES, then an animation may be performed,
556 // possibly after a small delay if |delay:| is YES. If |animate:| is NO,
557 // |delay:| will be ignored. In the case of multiple calls, later calls have
558 // precedence with the rule that |animate:NO| has precedence over |animate:YES|,
559 // and |delay:NO| has precedence over |delay:YES|.
560 - (BOOL)isBarVisibilityLockedForOwner:(id)owner;
561 - (void)lockBarVisibilityForOwner:(id)owner
562 withAnimation:(BOOL)animate
563 delay:(BOOL)delay;
564 - (void)releaseBarVisibilityForOwner:(id)owner
565 withAnimation:(BOOL)animate
566 delay:(BOOL)delay;
568 // Returns YES if any of the views in the floating bar currently has focus.
569 - (BOOL)floatingBarHasFocus;
571 @end // @interface BrowserWindowController(Fullscreen)
574 // Methods which are either only for testing, or only public for testing.
575 @interface BrowserWindowController (TestingAPI)
577 // Put the incognito badge or multi-profile avatar on the browser and adjust the
578 // tab strip accordingly.
579 - (void)installAvatar;
581 // Allows us to initWithBrowser withOUT taking ownership of the browser.
582 - (id)initWithBrowser:(Browser*)browser takeOwnership:(BOOL)ownIt;
584 // Adjusts the window height by the given amount. If the window spans from the
585 // top of the current workspace to the bottom of the current workspace, the
586 // height is not adjusted. If growing the window by the requested amount would
587 // size the window to be taller than the current workspace, the window height is
588 // capped to be equal to the height of the current workspace. If the window is
589 // partially offscreen, its height is not adjusted at all. This function
590 // prefers to grow the window down, but will grow up if needed. Calls to this
591 // function should be followed by a call to |layoutSubviews|.
592 // Returns if the window height was changed.
593 - (BOOL)adjustWindowHeightBy:(CGFloat)deltaH;
595 // Return an autoreleased NSWindow suitable for fullscreen use.
596 - (NSWindow*)createFullscreenWindow;
598 // Resets any saved state about window growth (due to showing the bookmark bar
599 // or the download shelf), so that future shrinking will occur from the bottom.
600 - (void)resetWindowGrowthState;
602 // Computes by how far in each direction, horizontal and vertical, the
603 // |source| rect doesn't fit into |target|.
604 - (NSSize)overflowFrom:(NSRect)source
605 to:(NSRect)target;
607 // The fullscreen exit bubble controller, or nil if the bubble isn't showing.
608 - (ExclusiveAccessBubbleWindowController*)exclusiveAccessBubbleWindowController;
610 // Gets the rect, in window base coordinates, that the omnibox popup should be
611 // positioned relative to.
612 - (NSRect)omniboxPopupAnchorRect;
614 @end // @interface BrowserWindowController (TestingAPI)
617 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_