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/exclusive_access_bubble_window_controller.h"
21 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
22 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h"
23 #import "chrome/browser/ui/cocoa/themed_window.h"
24 #import "chrome/browser/ui/cocoa/url_drop_target.h"
25 #import "chrome/browser/ui/cocoa/view_resizer.h"
26 #include "components/translate/core/common/translate_errors.h"
27 #include "ui/base/accelerators/accelerator_manager.h"
28 #include "ui/gfx/geometry/rect.h"
30 @
class AvatarBaseController
;
31 class BookmarkBubbleObserverCocoa
;
34 class BrowserWindowCocoa
;
35 @
class BrowserWindowFullscreenTransition
;
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
;
50 @
class ToolbarController
;
51 @
class TranslateBubbleController
;
57 namespace extensions
{
61 @interface BrowserWindowController
62 : TabWindowController
<BookmarkBarControllerDelegate
,
64 TabStripControllerDelegate
> {
66 // The ordering of these members is important as it determines the order in
67 // which they are destroyed. |browser_| needs to be destroyed last as most of
68 // the other objects hold weak references to it or things it owns
69 // (tab/toolbar/bookmark models, profiles, etc).
70 scoped_ptr
<Browser
> browser_
;
71 NSWindow
* savedRegularWindow_
;
72 scoped_ptr
<BrowserWindowCocoa
> windowShim_
;
73 base::scoped_nsobject
<ToolbarController
> toolbarController_
;
74 base::scoped_nsobject
<TabStripController
> tabStripController_
;
75 base::scoped_nsobject
<FindBarCocoaController
> findBarCocoaController_
;
76 base::scoped_nsobject
<InfoBarContainerController
> infoBarContainerController_
;
77 base::scoped_nsobject
<DownloadShelfController
> downloadShelfController_
;
78 base::scoped_nsobject
<BookmarkBarController
> bookmarkBarController_
;
79 base::scoped_nsobject
<DevToolsController
> devToolsController_
;
80 base::scoped_nsobject
<OverlayableContentsController
>
81 overlayableContentsController_
;
82 base::scoped_nsobject
<PresentationModeController
> presentationModeController_
;
83 base::scoped_nsobject
<ExclusiveAccessBubbleWindowController
>
84 exclusiveAccessBubbleWindowController_
;
85 base::scoped_nsobject
<BrowserWindowFullscreenTransition
>
86 fullscreenTransition_
;
88 // Strong. StatusBubble is a special case of a strong reference that
89 // we don't wrap in a scoped_ptr because it is acting the same
90 // as an NSWindowController in that it wraps a window that must
91 // be shut down before our destructors are called.
92 StatusBubbleMac
* statusBubble_
;
94 scoped_ptr
<BookmarkBubbleObserverCocoa
> bookmarkBubbleObserver_
;
95 BookmarkBubbleController
* bookmarkBubbleController_
; // Weak.
96 BOOL initializing_
; // YES while we are currently in initWithBrowser:
97 BOOL ownsBrowser_
; // Only ever NO when testing
99 TranslateBubbleController
* translateBubbleController_
; // Weak.
101 // The total amount by which we've grown the window up or down (to display a
102 // bookmark bar and/or download shelf), respectively; reset to 0 when moved
103 // away from the bottom/top or resized (or zoomed).
104 CGFloat windowTopGrowth_
;
105 CGFloat windowBottomGrowth_
;
107 // YES only if we're shrinking the window from an apparent zoomed state (which
108 // we'll only do if we grew it to the zoomed state); needed since we'll then
109 // restrict the amount of shrinking by the amounts specified above. Reset to
111 BOOL isShrinkingFromZoomed_
;
113 // The view controller that manages the incognito badge or the multi-profile
114 // avatar button. Depending on whether the --new-profile-management flag is
115 // used, the multi-profile button can either be the avatar's icon badge or a
116 // button with the profile's name. If the flag is used, the button is always
117 // shown, otherwise the view will always be in the view hierarchy but will
118 // be hidden unless it's appropriate to show it (i.e. if there's more than
120 base::scoped_nsobject
<AvatarBaseController
> avatarButtonController_
;
122 // Lazily created view which draws the background for the floating set of bars
123 // in presentation mode (for window types having a floating bar; it remains
124 // nil for those which don't).
125 base::scoped_nsobject
<NSView
> floatingBarBackingView_
;
127 // The borderless window used in fullscreen mode when Cocoa's System
128 // Fullscreen API is not being used (or not available, before OS 10.7).
129 base::scoped_nsobject
<NSWindow
> fullscreenWindow_
;
131 // True between |-windowWillEnterFullScreen:| and |-windowDidEnterFullScreen:|
132 // to indicate that the window is in the process of transitioning into
133 // AppKit fullscreen mode.
134 BOOL enteringAppKitFullscreen_
;
136 // True between |-windowWillExitFullScreen:| and |-windowDidExitFullScreen:|
137 // to indicate that the window is in the process of transitioning out of
138 // AppKit fullscreen mode.
139 BOOL exitingAppKitFullscreen_
;
141 // True between |enterImmersiveFullscreen| and |-windowDidEnterFullScreen:|
142 // to indicate that the window is in the process of transitioning into
143 // AppKit fullscreen mode.
144 BOOL enteringImmersiveFullscreen_
;
146 // True between |-setPresentationMode:url:bubbleType:| and
147 // |-windowDidEnterFullScreen:| to indicate that the window is in the process
148 // of transitioning into fullscreen presentation mode.
149 BOOL enteringPresentationMode_
;
151 // When the window is in the process of entering AppKit Fullscreen, this
152 // property indicates whether the window is being fullscreened on the
154 BOOL enteringAppKitFullscreenOnPrimaryScreen_
;
156 // The size of the original (non-fullscreen) window. This is saved just
157 // before entering fullscreen mode and is only valid when |-isFullscreen|
159 NSRect savedRegularWindowFrame_
;
161 // The proportion of the floating bar which is shown (in presentation mode).
162 CGFloat floatingBarShownFraction_
;
164 // Various UI elements/events may want to ensure that the floating bar is
165 // visible (in presentation mode), e.g., because of where the mouse is or
166 // where keyboard focus is. Whenever an object requires bar visibility, it has
167 // itself added to |barVisibilityLocks_|. When it no longer requires bar
168 // visibility, it has itself removed.
169 base::scoped_nsobject
<NSMutableSet
> barVisibilityLocks_
;
171 // Bar visibility locks and releases only result (when appropriate) in changes
172 // in visible state when the following is |YES|.
173 BOOL barVisibilityUpdatesEnabled_
;
175 // When going fullscreen for a tab, we need to store the URL and the
176 // fullscreen type, since we can't show the bubble until
177 // -windowDidEnterFullScreen: gets called.
179 ExclusiveAccessBubbleType exclusiveAccessBubbleType_
;
181 // The Extension Command Registry used to determine which keyboard events to
183 scoped_ptr
<ExtensionKeybindingRegistryCocoa
> extension_keybinding_registry_
;
186 // A convenience class method which gets the |BrowserWindowController| for a
187 // given window. This method returns nil if no window in the chain has a BWC.
188 + (BrowserWindowController
*)browserWindowControllerForWindow
:(NSWindow
*)window
;
190 // A convenience class method which gets the |BrowserWindowController| for a
191 // given view. This is the controller for the window containing |view|, if it
192 // is a BWC, or the first controller in the parent-window chain that is a
193 // BWC. This method returns nil if no window in the chain has a BWC.
194 + (BrowserWindowController
*)browserWindowControllerForView
:(NSView
*)view
;
196 // Load the browser window nib and do any Cocoa-specific initialization.
197 // Takes ownership of |browser|.
198 - (id
)initWithBrowser
:(Browser
*)browser
;
200 // Call to make the browser go away from other places in the cross-platform
202 - (void)destroyBrowser
;
204 // Ensure bounds for the window abide by the minimum window size.
205 - (gfx::Rect
)enforceMinWindowSize
:(gfx::Rect
)bounds
;
207 // Access the C++ bridge between the NSWindow and the rest of Chromium.
208 - (BrowserWindow
*)browserWindow
;
210 // Return a weak pointer to the toolbar controller.
211 - (ToolbarController
*)toolbarController
;
213 // Return a weak pointer to the tab strip controller.
214 - (TabStripController
*)tabStripController
;
216 // Return a weak pointer to the find bar controller.
217 - (FindBarCocoaController
*)findBarCocoaController
;
219 // Access the ObjC controller that contains the infobars.
220 - (InfoBarContainerController
*)infoBarContainerController
;
222 // Access the C++ bridge object representing the status bubble for the window.
223 - (StatusBubbleMac
*)statusBubble
;
225 // Access the C++ bridge object representing the location bar.
226 - (LocationBarViewMac
*)locationBarBridge
;
228 // Returns a weak pointer to the floating bar backing view;
229 - (NSView
*)floatingBarBackingView
;
231 // Returns a weak pointer to the overlayable contents controller.
232 - (OverlayableContentsController
*)overlayableContentsController
;
234 // Access the Profile object that backs this Browser.
237 // Access the avatar button controller.
238 - (AvatarBaseController
*)avatarButtonController
;
240 // Forces the toolbar (and transitively the location bar) to update its current
241 // state. If |tab| is non-NULL, we're switching (back?) to this tab and should
242 // restore any previous location bar state (such as user editing) as well.
243 - (void)updateToolbarWithContents
:(content::WebContents
*)tab
;
245 // Resets the toolbar's tab state for |tab|.
246 - (void)resetTabState
:(content::WebContents
*)tab
;
248 // Sets whether or not the current page in the frontmost tab is bookmarked.
249 - (void)setStarredState
:(BOOL
)isStarred
;
251 // Sets whether or not the current page is translated.
252 - (void)setCurrentPageIsTranslated
:(BOOL
)on
;
254 // Invoked via BrowserWindowCocoa::OnActiveTabChanged, happens whenever a
255 // new tab becomes active.
256 - (void)onActiveTabChanged
:(content::WebContents
*)oldContents
257 to
:(content::WebContents
*)newContents
;
259 // Happens when the zoom level is changed in the active tab, the active tab is
260 // changed, or a new browser window or tab is created. |canShowBubble| denotes
261 // whether it would be appropriate to show a zoom bubble or not.
262 - (void)zoomChangedForActiveTab
:(BOOL
)canShowBubble
;
264 // Return the rect, in WebKit coordinates (flipped), of the window's grow box
265 // in the coordinate system of the content area of the currently selected tab.
266 - (NSRect
)selectedTabGrowBoxRect
;
268 // Called to tell the selected tab to update its loading state.
269 // |force| is set if the update is due to changing tabs, as opposed to
270 // the page-load finishing. See comment in reload_button_cocoa.h.
271 - (void)setIsLoading
:(BOOL
)isLoading force
:(BOOL
)force
;
273 // Brings this controller's window to the front.
276 // Make the location bar the first responder, if possible.
277 - (void)focusLocationBar
:(BOOL
)selectAll
;
279 // Make the (currently-selected) tab contents the first responder, if possible.
280 - (void)focusTabContents
;
282 // Returns the frame of the regular (non-fullscreened) window (even if the
283 // window is currently in fullscreen mode). The frame is returned in Cocoa
284 // coordinates (origin in bottom-left).
285 - (NSRect
)regularWindowFrame
;
287 // Whether or not to show the avatar, which is either the incognito guy or the
288 // user's profile avatar.
289 - (BOOL
)shouldShowAvatar
;
291 // Whether or not to show the new avatar button used by --new-profile-maagement.
292 - (BOOL
)shouldUseNewAvatarButton
;
294 - (BOOL
)isBookmarkBarVisible
;
296 // Returns YES if the bookmark bar is currently animating.
297 - (BOOL
)isBookmarkBarAnimating
;
299 - (BookmarkBarController
*)bookmarkBarController
;
301 - (DevToolsController
*)devToolsController
;
303 - (BOOL
)isDownloadShelfVisible
;
305 // Lazily creates the download shelf in visible state if it doesn't exist yet.
306 - (void)createAndAddDownloadShelf
;
308 // Returns the download shelf controller, if it exists.
309 - (DownloadShelfController
*)downloadShelf
;
311 // Retains the given FindBarCocoaController and adds its view to this
312 // browser window. Must only be called once per
313 // BrowserWindowController.
314 - (void)addFindBar
:(FindBarCocoaController
*)findBarCocoaController
;
316 // The user changed the theme.
317 - (void)userChangedTheme
;
319 // Consults the Command Registry to see if this |event| needs to be handled as
320 // an extension command and returns YES if so (NO otherwise).
321 // Only extensions with the given |priority| are considered.
322 - (BOOL
)handledByExtensionCommand
:(NSEvent
*)event
323 priority
:(ui::AcceleratorManager::HandlerPriority
)priority
;
325 // Delegate method for the status bubble to query its base frame.
326 - (NSRect
)statusBubbleBaseFrame
;
328 // Show the bookmark bubble (e.g. user just clicked on the STAR)
329 - (void)showBookmarkBubbleForURL
:(const GURL
&)url
330 alreadyBookmarked
:(BOOL
)alreadyBookmarked
;
332 // Show the translate bubble.
333 - (void)showTranslateBubbleForWebContents
:(content::WebContents
*)contents
334 step
:(translate::TranslateStep
)step
336 (translate::TranslateErrors::Type
)errorType
;
338 // Dismiss the permission bubble
339 - (void)dismissPermissionBubble
;
341 // Shows or hides the docked web inspector depending on |contents|'s state.
342 - (void)updateDevToolsForContents
:(content::WebContents
*)contents
;
344 // Gets the current theme provider.
345 - (ui::ThemeProvider
*)themeProvider
;
347 // Gets the window style.
348 - (ThemedWindowStyle
)themedWindowStyle
;
350 // Returns the position in window coordinates that the top left of a theme
351 // image with |alignment| should be painted at. If the window does not have a
352 // tab strip, the offset for THEME_IMAGE_ALIGN_WITH_FRAME is always returned.
353 // The result of this method can be used in conjunction with
354 // [NSGraphicsContext cr_setPatternPhase:] to set the offset of pattern colors.
355 - (NSPoint
)themeImagePositionForAlignment
:(ThemeImageAlignment
)alignment
;
357 // Return the point to which a bubble window's arrow should point, in window
359 - (NSPoint
)bookmarkBubblePoint
;
361 // Called by BookmarkBubbleObserverCocoa when the bubble is closed.
362 - (void)bookmarkBubbleClosed
;
364 // Called when the Add Search Engine dialog is closed.
365 - (void)sheetDidEnd
:(NSWindow
*)sheet
366 returnCode
:(NSInteger
)code
367 context
:(void*)context
;
369 // Executes the command registered by the extension that has the given id.
370 - (void)executeExtensionCommand
:(const std::string
&)extension_id
371 command
:(const extensions::Command
&)command
;
373 @end
// @interface BrowserWindowController
376 // Methods having to do with the window type (normal/popup/app, and whether the
377 // window has various features; fullscreen and presentation mode methods are
379 @interface
BrowserWindowController(WindowType
)
381 // Determines whether this controller's window supports a given feature (i.e.,
382 // whether a given feature is or can be shown in the window).
383 // TODO(viettrungluu): |feature| is really should be |Browser::Feature|, but I
384 // don't want to include browser.h (and you can't forward declare enums).
385 - (BOOL
)supportsWindowFeature
:(int)feature
;
387 // Called to check whether or not this window has a normal title bar (YES if it
388 // does, NO otherwise). (E.g., normal browser windows do not, pop-ups do.)
391 // Called to check whether or not this window has a toolbar (YES if it does, NO
392 // otherwise). (E.g., normal browser windows do, pop-ups do not.)
395 // Called to check whether or not this window has a location bar (YES if it
396 // does, NO otherwise). (E.g., normal browser windows do, pop-ups may or may
398 - (BOOL
)hasLocationBar
;
400 // Called to check whether or not this window can have bookmark bar (YES if it
401 // does, NO otherwise). (E.g., normal browser windows may, pop-ups may not.)
402 - (BOOL
)supportsBookmarkBar
;
404 // Called to check if this controller's window is a tabbed window (e.g., not a
405 // pop-up window). Returns YES if it is, NO otherwise.
406 // Note: The |-has...| methods are usually preferred, so this method is largely
408 - (BOOL
)isTabbedWindow
;
410 @end
// @interface BrowserWindowController(WindowType)
412 // Fullscreen terminology:
414 // ----------------------------------------------------------------------------
415 // There are 2 APIs that cause the window to get resized, and possibly move
418 // + AppKitFullscreen API: AppKit touts a feature known as "fullscreen". This
419 // involves moving the current window to a different space, and resizing the
420 // window to take up the entire size of the screen.
422 // + Immersive fullscreen: An alternative to AppKitFullscreen API. Uses on 10.6
423 // (before AppKitFullscreen API was available), and on certain HTML/Flash
424 // content. This is a method defined by Chrome.
426 // The Immersive fullscreen API can be called after the AppKitFullscreen API.
427 // Calling the AppKitFullscreen API while immersive fullscreen API has been
428 // invoked causes all fullscreen modes to exit.
430 // ----------------------------------------------------------------------------
431 // There are 3 "styles" of omnibox sliding.
432 // + OMNIBOX_TABS_PRESENT: Both the omnibox and the tabstrip are present.
433 // Moving the cursor to the top causes the menubar to appear, and everything
434 // else to slide down.
435 // + OMNIBOX_TABS_HIDDEN: Both tabstrip and omnibox are hidden. Moving cursor
436 // to top shows tabstrip, omnibox, and menu bar.
437 // + OMNIBOX_TABS_NONE: Both tabstrip and omnibox are hidden. Moving cursor
438 // to top causes the menubar to appear, but not the tabstrip and omnibox.
440 // The omnibox sliding styles are used in conjunction with the fullscreen APIs.
441 // There is exactly 1 sliding style active at a time. The sliding is mangaged
442 // by the presentationModeController_. (poorly named).
444 // ----------------------------------------------------------------------------
445 // There are several "fullscreen modes" bantered around. Technically, any
446 // fullscreen API can be combined with any sliding style.
448 // + System fullscreen***deprecated***: This term is confusing. Don't use it.
449 // It either refers to the AppKitFullscreen API, or the behavior that users
450 // expect to see when they click the fullscreen button, or some Chrome specific
451 // implementation that uses the AppKitFullscreen API.
453 // + Canonical Fullscreen: When a user clicks on the fullscreen button, they
454 // expect a fullscreen behavior similar to other AppKit apps.
455 // - AppKitFullscreen API + OMNIBOX_TABS_PRESENT.
456 // - The button click directly invokes the AppKitFullscreen API. This class
457 // get a callback, and calls adjustUIForOmniboxFullscreen.
458 // - There is a menu item that is intended to invoke the same behavior. When
459 // the user clicks the menu item, or use its hotkey, this class invokes the
460 // AppKitFullscreen API.
462 // + Presentation Mode:
463 // - OMNIBOX_TABS_HIDDEN, typically with AppKitFullscreen API, but can
464 // also be with Immersive fullscreen API.
465 // - This class sets a flag, indicating that it wants Presentation Mode
466 // instead of Canonical Fullscreen. Then it invokes the AppKitFullscreen API.
468 // + HTML5 fullscreen. <-- Currently uses AppKitFullscreen API. This should
469 // eventually migrate to the Immersive Fullscreen API.
471 // There are more fullscreen styles on OSX than other OSes. However, all OSes
472 // share the same cross-platform code for entering fullscreen
473 // (FullscreenController). It is important for OSX fullscreen logic to track
474 // how the user triggered fullscreen mode.
475 // There are currently 5 possible mechanisms:
476 // - User clicks the AppKit Fullscreen button.
477 // -- This invokes -[BrowserWindowController windowWillEnterFullscreen:]
478 // - User selects the menu item "Enter Full Screen".
479 // -- This invokes FullscreenController::ToggleFullscreenModeInternal(
480 // BROWSER_WITH_CHROME)
481 // - User selects the menu item "Enter Presentation Mode".
482 // -- This invokes FullscreenController::ToggleFullscreenModeInternal(
484 // -- The corresponding URL will be empty.
485 // - User requests fullscreen via an extension.
486 // -- This invokes FullscreenController::ToggleFullscreenModeInternal(
488 // -- The corresponding URL will be the url of the extension.
489 // - User requests fullscreen via Flash or JavaScript apis.
490 // -- This invokes FullscreenController::ToggleFullscreenModeInternal(
492 // -- browser_->fullscreen_controller()->
493 // IsWindowFullscreenForTabOrPending() returns true.
494 // -- The corresponding URL will be the url of the web page.
496 // Methods having to do with fullscreen and presentation mode.
497 @interface
BrowserWindowController(Fullscreen
)
499 // Toggles fullscreen mode. Meant to be called by Lion windows when they enter
500 // or exit Lion fullscreen mode. Must not be called on Snow Leopard or earlier.
501 - (void)handleLionToggleFullscreen
;
503 // Enters Browser/Appkit Fullscreen.
504 // If |withToolbar| is NO, the tab strip and toolbar are hidden
505 // (aka Presentation Mode).
506 - (void)enterBrowserFullscreenWithToolbar
:(BOOL
)withToolbar
;
508 // Adds or removes the tab strip and toolbar from the current window. The
509 // window must be in immersive or AppKit Fullscreen.
510 - (void)updateFullscreenWithToolbar
:(BOOL
)withToolbar
;
512 // Updates the contents of the fullscreen exit bubble with |url| and
514 - (void)updateFullscreenExitBubbleURL
:(const GURL
&)url
515 bubbleType
:(ExclusiveAccessBubbleType
)bubbleType
;
517 // Returns YES if the browser window is in or entering any fullscreen mode.
518 - (BOOL
)isInAnyFullscreenMode
;
520 // Returns YES if the browser window is currently in or entering fullscreen via
521 // the built-in immersive mechanism.
522 - (BOOL
)isInImmersiveFullscreen
;
524 // Returns YES if the browser window is currently in or entering fullscreen via
525 // the AppKit Fullscreen API.
526 - (BOOL
)isInAppKitFullscreen
;
528 // Enter fullscreen for an extension.
529 - (void)enterExtensionFullscreenForURL
:(const GURL
&)url
530 bubbleType
:(ExclusiveAccessBubbleType
)bubbleType
;
532 // Enters Immersive Fullscreen for the given URL.
533 - (void)enterWebContentFullscreenForURL
:(const GURL
&)url
534 bubbleType
:(ExclusiveAccessBubbleType
)bubbleType
;
536 // Exits the current fullscreen mode.
537 - (void)exitAnyFullscreen
;
539 // Whether the system is in the very specific fullscreen mode: Presentation
541 - (BOOL
)inPresentationMode
;
543 // Resizes the fullscreen window to fit the screen it's currently on. Called by
544 // the PresentationModeController when there is a change in monitor placement or
546 - (void)resizeFullscreenWindow
;
548 // Query/lock/release the requirement that the tab strip/toolbar/attached
549 // bookmark bar bar cluster is visible (e.g., when one of its elements has
550 // focus). This is required for the floating bar in presentation mode, but
551 // should also be called when not in presentation mode; see the comments for
552 // |barVisibilityLocks_| for more details. Double locks/releases by the same
553 // owner are ignored. If |animate:| is YES, then an animation may be performed,
554 // possibly after a small delay if |delay:| is YES. If |animate:| is NO,
555 // |delay:| will be ignored. In the case of multiple calls, later calls have
556 // precedence with the rule that |animate:NO| has precedence over |animate:YES|,
557 // and |delay:NO| has precedence over |delay:YES|.
558 - (BOOL
)isBarVisibilityLockedForOwner
:(id
)owner
;
559 - (void)lockBarVisibilityForOwner
:(id
)owner
560 withAnimation
:(BOOL
)animate
562 - (void)releaseBarVisibilityForOwner
:(id
)owner
563 withAnimation
:(BOOL
)animate
566 // Returns YES if any of the views in the floating bar currently has focus.
567 - (BOOL
)floatingBarHasFocus
;
569 @end
// @interface BrowserWindowController(Fullscreen)
572 // Methods which are either only for testing, or only public for testing.
573 @interface
BrowserWindowController (TestingAPI
)
575 // Put the incognito badge or multi-profile avatar on the browser and adjust the
576 // tab strip accordingly.
577 - (void)installAvatar
;
579 // Allows us to initWithBrowser withOUT taking ownership of the browser.
580 - (id
)initWithBrowser
:(Browser
*)browser takeOwnership
:(BOOL
)ownIt
;
582 // Adjusts the window height by the given amount. If the window spans from the
583 // top of the current workspace to the bottom of the current workspace, the
584 // height is not adjusted. If growing the window by the requested amount would
585 // size the window to be taller than the current workspace, the window height is
586 // capped to be equal to the height of the current workspace. If the window is
587 // partially offscreen, its height is not adjusted at all. This function
588 // prefers to grow the window down, but will grow up if needed. Calls to this
589 // function should be followed by a call to |layoutSubviews|.
590 // Returns if the window height was changed.
591 - (BOOL
)adjustWindowHeightBy
:(CGFloat
)deltaH
;
593 // Return an autoreleased NSWindow suitable for fullscreen use.
594 - (NSWindow
*)createFullscreenWindow
;
596 // Resets any saved state about window growth (due to showing the bookmark bar
597 // or the download shelf), so that future shrinking will occur from the bottom.
598 - (void)resetWindowGrowthState
;
600 // Computes by how far in each direction, horizontal and vertical, the
601 // |source| rect doesn't fit into |target|.
602 - (NSSize
)overflowFrom
:(NSRect
)source
605 // The fullscreen exit bubble controller, or nil if the bubble isn't showing.
606 - (ExclusiveAccessBubbleWindowController
*)exclusiveAccessBubbleWindowController
;
608 // Gets the rect, in window base coordinates, that the omnibox popup should be
609 // positioned relative to.
610 - (NSRect
)omniboxPopupAnchorRect
;
612 @end
// @interface BrowserWindowController (TestingAPI)
615 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_CONTROLLER_H_