| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #import "chrome/browser/cocoa/view_resizer.h" |
| 9 #include "chrome/common/notification_registrar.h" | 10 #include "chrome/common/notification_registrar.h" |
| 10 | 11 |
| 11 @class BrowserWindowController; | |
| 12 class InfoBarDelegate; | 12 class InfoBarDelegate; |
| 13 class InfoBarNotificationObserver; | 13 class InfoBarNotificationObserver; |
| 14 class TabContents; | 14 class TabContents; |
| 15 class TabStripModel; | 15 class TabStripModel; |
| 16 class TabStripModelObserverBridge; | 16 class TabStripModelObserverBridge; |
| 17 | 17 |
| 18 // Controller for the infobar container view, which is the superview | 18 // Controller for the infobar container view, which is the superview |
| 19 // of all the infobar views. This class owns zero or more | 19 // of all the infobar views. This class owns zero or more |
| 20 // InfoBarControllers, which manage the infobar views. This class | 20 // InfoBarControllers, which manage the infobar views. This class |
| 21 // also receives tab strip model notifications and handles | 21 // also receives tab strip model notifications and handles |
| 22 // adding/removing infobars when needed. | 22 // adding/removing infobars when needed. |
| 23 @interface InfoBarContainerController : NSViewController { | 23 @interface InfoBarContainerController : NSViewController { |
| 24 @private | 24 @private |
| 25 // Needed to send infoBarResized: messages when infobars are added or removed. | 25 // Needed to send resize messages when infobars are added or removed. |
| 26 BrowserWindowController* browserController_; // weak, owns us. | 26 id<ViewResizer> resizeDelegate_; // weak |
| 27 | 27 |
| 28 // The TabContents we are currently showing infobars for. | 28 // The TabContents we are currently showing infobars for. |
| 29 TabContents* currentTabContents_; // weak | 29 TabContents* currentTabContents_; // weak |
| 30 | 30 |
| 31 // Holds the InfoBarControllers currently owned by this container. | 31 // Holds the InfoBarControllers currently owned by this container. |
| 32 scoped_nsobject<NSMutableArray> infobarControllers_; | 32 scoped_nsobject<NSMutableArray> infobarControllers_; |
| 33 | 33 |
| 34 // Lets us get TabChanged/TabDetachedAt notifications. | 34 // Lets us get TabChanged/TabDetachedAt notifications. |
| 35 scoped_ptr<TabStripModelObserverBridge> tabObserver_; | 35 scoped_ptr<TabStripModelObserverBridge> tabObserver_; |
| 36 | 36 |
| 37 // Lets us registers for INFOBAR_ADDED/INFOBAR_REMOVED | 37 // Lets us registers for INFOBAR_ADDED/INFOBAR_REMOVED |
| 38 // notifications. The actual notifications are sent to the | 38 // notifications. The actual notifications are sent to the |
| 39 // InfoBarNotificationObserver object, which proxies them back to us. | 39 // InfoBarNotificationObserver object, which proxies them back to us. |
| 40 NotificationRegistrar registrar_; | 40 NotificationRegistrar registrar_; |
| 41 scoped_ptr<InfoBarNotificationObserver> infoBarObserver_; | 41 scoped_ptr<InfoBarNotificationObserver> infoBarObserver_; |
| 42 } | 42 } |
| 43 | 43 |
| 44 - (id)initWithTabStripModel:(TabStripModel*)model | 44 - (id)initWithTabStripModel:(TabStripModel*)model |
| 45 browserWindowController:(BrowserWindowController*)controller; | 45 resizeDelegate:(id<ViewResizer>)resizeDelegate; |
| 46 | 46 |
| 47 // Informs the selected TabContents that the infobars for the given | 47 // Informs the selected TabContents that the infobars for the given |
| 48 // |delegate| need to be removed. Does not remove any infobar views | 48 // |delegate| need to be removed. Does not remove any infobar views |
| 49 // directly, as they will be removed when handling the subsequent | 49 // directly, as they will be removed when handling the subsequent |
| 50 // INFOBAR_REMOVED notification. Does not notify |delegate| that the | 50 // INFOBAR_REMOVED notification. Does not notify |delegate| that the |
| 51 // infobar was closed. | 51 // infobar was closed. |
| 52 - (void)removeDelegate:(InfoBarDelegate*)delegate; | 52 - (void)removeDelegate:(InfoBarDelegate*)delegate; |
| 53 | 53 |
| 54 @end | 54 @end |
| 55 | 55 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 71 @end | 71 @end |
| 72 | 72 |
| 73 | 73 |
| 74 @interface InfoBarContainerController (JustForTesting) | 74 @interface InfoBarContainerController (JustForTesting) |
| 75 | 75 |
| 76 // Removes all infobar views. Callers must call | 76 // Removes all infobar views. Callers must call |
| 77 // positionInfoBarsAndRedraw() after calling this method. | 77 // positionInfoBarsAndRedraw() after calling this method. |
| 78 - (void)removeAllInfoBars; | 78 - (void)removeAllInfoBars; |
| 79 | 79 |
| 80 @end | 80 @end |
| OLD | NEW |