| OLD | NEW |
| 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_INFOBARS_INFOBAR_CONTAINER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_CONTAINER_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_CONTAINER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_CONTAINER_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 10 | 10 |
| 11 #include "base/memory/scoped_nsobject.h" | 11 #include "base/memory/scoped_nsobject.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #import "chrome/browser/ui/cocoa/view_resizer.h" | 13 #import "chrome/browser/ui/cocoa/view_resizer.h" |
| 14 #include "content/common/notification_registrar.h" | 14 #include "content/common/notification_registrar.h" |
| 15 | 15 |
| 16 @class InfoBarController; | 16 @class InfoBarController; |
| 17 class InfoBar; |
| 17 class InfoBarDelegate; | 18 class InfoBarDelegate; |
| 18 class InfoBarNotificationObserver; | 19 class InfoBarNotificationObserver; |
| 19 class TabContentsWrapper; | 20 class TabContentsWrapper; |
| 20 class TabStripModel; | 21 class TabStripModel; |
| 21 | 22 |
| 22 // Protocol for basic container methods, as needed by an InfoBarController. | 23 // Protocol for basic container methods, as needed by an InfoBarController. |
| 23 // This protocol exists to make mocking easier in unittests. | 24 // This protocol exists to make mocking easier in unittests. |
| 24 @protocol InfoBarContainer | 25 @protocol InfoBarContainer |
| 25 - (void)removeDelegate:(InfoBarDelegate*)delegate; | 26 - (void)removeDelegate:(InfoBarDelegate*)delegate; |
| 26 - (void)willRemoveController:(InfoBarController*)controller; | 27 - (void)willRemoveController:(InfoBarController*)controller; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // Returns the amount of additional height the container view needs to draw the | 103 // Returns the amount of additional height the container view needs to draw the |
| 103 // anti-spoofing tip. This will return 0 if |-infobarCount| is 0. This is the | 104 // anti-spoofing tip. This will return 0 if |-infobarCount| is 0. This is the |
| 104 // total amount of overlap for all infobars. | 105 // total amount of overlap for all infobars. |
| 105 - (CGFloat)antiSpoofHeight; | 106 - (CGFloat)antiSpoofHeight; |
| 106 | 107 |
| 107 @end | 108 @end |
| 108 | 109 |
| 109 | 110 |
| 110 @interface InfoBarContainerController (ForTheObserverAndTesting) | 111 @interface InfoBarContainerController (ForTheObserverAndTesting) |
| 111 | 112 |
| 112 // Adds an infobar view for the given delegate. | 113 // Adds the given infobar. Takes ownership of |infobar|. |
| 113 - (void)addInfoBar:(InfoBarDelegate*)delegate animate:(BOOL)animate; | 114 - (void)addInfoBar:(InfoBar*)infobar |
| 115 animate:(BOOL)animate |
| 116 deleteImmediately:(BOOL)deleteImmediately; |
| 114 | 117 |
| 115 // Closes all the infobar views for a given delegate, either immediately or by | 118 // Closes all the infobar views for a given delegate, either immediately or by |
| 116 // starting a close animation. | 119 // starting a close animation. |
| 117 - (void)closeInfoBarsForDelegate:(InfoBarDelegate*)delegate | 120 - (void)closeInfoBarsForDelegate:(InfoBarDelegate*)delegate |
| 118 animate:(BOOL)animate; | 121 animate:(BOOL)animate; |
| 119 | 122 |
| 120 // Replaces all info bars for the delegate with a new info bar. | |
| 121 // This simply calls closeInfoBarsForDelegate: and then addInfoBar:. | |
| 122 - (void)replaceInfoBarsForDelegate:(InfoBarDelegate*)old_delegate | |
| 123 with:(InfoBarDelegate*)new_delegate; | |
| 124 | |
| 125 // Positions the infobar views in the container view and notifies | 123 // Positions the infobar views in the container view and notifies |
| 126 // |browser_controller_| that it needs to resize the container view. | 124 // |browser_controller_| that it needs to resize the container view. |
| 127 - (void)positionInfoBarsAndRedraw; | 125 - (void)positionInfoBarsAndRedraw; |
| 128 | 126 |
| 129 @end | 127 @end |
| 130 | 128 |
| 131 | 129 |
| 132 @interface InfoBarContainerController (JustForTesting) | 130 @interface InfoBarContainerController (JustForTesting) |
| 133 | 131 |
| 134 // Removes all infobar views. Infobars which were already closing will be | 132 // Removes all infobar views. Infobars which were already closing will be |
| 135 // completely closed (i.e. InfobarDelegate::InfoBarClosed() will be called and | 133 // completely closed (i.e. InfobarDelegate::InfoBarClosed() will be called and |
| 136 // we'll get a callback to removeController). Other infobars will simply stop | 134 // we'll get a callback to removeController). Other infobars will simply stop |
| 137 // animating and disappear. Callers must call positionInfoBarsAndRedraw() | 135 // animating and disappear. Callers must call positionInfoBarsAndRedraw() |
| 138 // after calling this method. | 136 // after calling this method. |
| 139 - (void)removeAllInfoBars; | 137 - (void)removeAllInfoBars; |
| 140 | 138 |
| 141 @end | 139 @end |
| 142 | 140 |
| 143 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_CONTAINER_CONTROLLER_H_ | 141 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_CONTAINER_CONTROLLER_H_ |
| OLD | NEW |