diff options
Diffstat (limited to 'chrome/browser/cocoa/infobar_container_controller.h')
-rw-r--r-- | chrome/browser/cocoa/infobar_container_controller.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/infobar_container_controller.h b/chrome/browser/cocoa/infobar_container_controller.h new file mode 100644 index 0000000..a565a10 --- /dev/null +++ b/chrome/browser/cocoa/infobar_container_controller.h @@ -0,0 +1,80 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import <Cocoa/Cocoa.h> + +#include "base/scoped_nsobject.h" +#include "base/scoped_ptr.h" +#include "chrome/common/notification_registrar.h" + +@class BrowserWindowController; +class InfoBarDelegate; +class InfoBarNotificationObserver; +class TabContents; +class TabStripModel; +class TabStripModelObserverBridge; + +// Controller for the infobar container view, which is the superview +// of all the infobar views. This class owns zero or more +// InfoBarControllers, which manage the infobar views. This class +// also receives tab strip model notifications and handles +// adding/removing infobars when needed. +@interface InfoBarContainerController : NSViewController { + @private + // Needed to send infoBarResized: messages when infobars are added or removed. + BrowserWindowController* browserController_; // weak, owns us. + + // The TabContents we are currently showing infobars for. + TabContents* currentTabContents_; // weak + + // Holds the InfoBarControllers currently owned by this container. + scoped_nsobject<NSMutableArray> infobarControllers_; + + // Lets us get TabChanged/TabDetachedAt notifications. + scoped_ptr<TabStripModelObserverBridge> tabObserver_; + + // Lets us registers for INFOBAR_ADDED/INFOBAR_REMOVED + // notifications. The actual notifications are sent to the + // InfoBarNotificationObserver object, which proxies them back to us. + NotificationRegistrar registrar_; + scoped_ptr<InfoBarNotificationObserver> infoBarObserver_; +} + +- (id)initWithTabStripModel:(TabStripModel*)model + browserWindowController:(BrowserWindowController*)controller; + +// Informs the selected TabContents that the infobars for the given +// |delegate| need to be removed. Does not remove any infobar views +// directly, as they will be removed when handling the subsequent +// INFOBAR_REMOVED notification. Does not notify |delegate| that the +// infobar was closed. +- (void)removeDelegate:(InfoBarDelegate*)delegate; + +@end + + +@interface InfoBarContainerController (ForTheObserverAndTesting) + +// Adds an infobar view for the given delegate. Callers must call +// positionInfoBarsAndRedraw after calling this method. +- (void)addInfoBar:(InfoBarDelegate*)delegate; + +// Removes all the infobar views for a given delegate. Callers must +// call positionInfoBarsAndRedraw after calling this method. +- (void)removeInfoBarsForDelegate:(InfoBarDelegate*)delegate; + +// Positions the infobar views in the container view and notifies +// |browser_controller_| that it needs to resize the container view. +- (void)positionInfoBarsAndRedraw; + +@end + + +@interface InfoBarContainerController (JustForTesting) + +// Removes all infobar views. Callers must call +// positionInfoBarsAndRedraw() after calling this method. +- (void)removeAllInfoBars; + +@end |