| 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 BrowserWindowController; |
| 16 @class InfoBarController; | 17 @class InfoBarController; |
| 17 class InfoBar; | 18 class InfoBar; |
| 18 class InfoBarDelegate; | 19 class InfoBarDelegate; |
| 19 class InfoBarNotificationObserver; | 20 class InfoBarNotificationObserver; |
| 20 class TabContentsWrapper; | 21 class TabContentsWrapper; |
| 21 class TabStripModel; | 22 class TabStripModel; |
| 22 | 23 |
| 23 // Protocol for basic container methods, as needed by an InfoBarController. | 24 // Protocol for basic container methods, as needed by an InfoBarController. |
| 24 // This protocol exists to make mocking easier in unittests. | 25 // This protocol exists to make mocking easier in unittests. |
| 25 @protocol InfoBarContainer | 26 @protocol InfoBarContainer |
| 26 - (void)willRemoveController:(InfoBarController*)controller; | 27 - (void)willRemoveController:(InfoBarController*)controller; |
| 27 - (void)removeController:(InfoBarController*)controller; | 28 - (void)removeController:(InfoBarController*)controller; |
| 29 - (BrowserWindowController*)browserWindowController; |
| 28 @end | 30 @end |
| 29 | 31 |
| 30 | 32 |
| 31 namespace infobars { | 33 namespace infobars { |
| 32 | 34 |
| 33 // How tall the tip is on a normal infobar. | 35 // The height of an infobar without the tip. |
| 34 const CGFloat kBaseHeight = 36.0; | 36 const CGFloat kBaseHeight = 36.0; |
| 35 | 37 |
| 38 // The height of the infobar tip. |
| 39 const CGFloat kTipHeight = 12.0; |
| 40 |
| 36 }; // namespace infobars | 41 }; // namespace infobars |
| 37 | 42 |
| 38 | 43 |
| 39 // Controller for the infobar container view, which is the superview | 44 // Controller for the infobar container view, which is the superview |
| 40 // of all the infobar views. This class owns zero or more | 45 // of all the infobar views. This class owns zero or more |
| 41 // InfoBarControllers, which manage the infobar views. This class | 46 // InfoBarControllers, which manage the infobar views. This class |
| 42 // also receives tab strip model notifications and handles | 47 // also receives tab strip model notifications and handles |
| 43 // adding/removing infobars when needed. | 48 // adding/removing infobars when needed. |
| 44 @interface InfoBarContainerController : NSViewController <ViewResizer, | 49 @interface InfoBarContainerController : NSViewController <ViewResizer, |
| 45 InfoBarContainer> { | 50 InfoBarContainer> { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // if |contents| is the current tab contents. | 93 // if |contents| is the current tab contents. |
| 89 - (void)tabDetachedWithContents:(TabContentsWrapper*)contents; | 94 - (void)tabDetachedWithContents:(TabContentsWrapper*)contents; |
| 90 | 95 |
| 91 // Returns the number of active infobars. This is | 96 // Returns the number of active infobars. This is |
| 92 // |infobarControllers_ - closingInfoBars_|. | 97 // |infobarControllers_ - closingInfoBars_|. |
| 93 - (NSUInteger)infobarCount; | 98 - (NSUInteger)infobarCount; |
| 94 | 99 |
| 95 // Returns the amount of additional height the container view needs to draw the | 100 // Returns the amount of additional height the container view needs to draw the |
| 96 // anti-spoofing tip. This will return 0 if |-infobarCount| is 0. This is the | 101 // anti-spoofing tip. This will return 0 if |-infobarCount| is 0. This is the |
| 97 // total amount of overlap for all infobars. | 102 // total amount of overlap for all infobars. |
| 98 - (CGFloat)antiSpoofHeight; | 103 - (CGFloat)overlappingTipHeight; |
| 99 | 104 |
| 100 @end | 105 @end |
| 101 | 106 |
| 102 | 107 |
| 103 @interface InfoBarContainerController (ForTheObserverAndTesting) | 108 @interface InfoBarContainerController (ForTheObserverAndTesting) |
| 104 | 109 |
| 105 // Adds the given infobar. Takes ownership of |infobar|. | 110 // Adds the given infobar. Takes ownership of |infobar|. |
| 106 - (void)addInfoBar:(InfoBar*)infobar animate:(BOOL)animate; | 111 - (void)addInfoBar:(InfoBar*)infobar animate:(BOOL)animate; |
| 107 | 112 |
| 108 // Closes all the infobar views for a given delegate, either immediately or by | 113 // Closes all the infobar views for a given delegate, either immediately or by |
| (...skipping 13 matching lines...) Expand all Loading... |
| 122 // Removes all infobar views. Infobars which were already closing will be | 127 // Removes all infobar views. Infobars which were already closing will be |
| 123 // completely closed (i.e. InfobarDelegate::InfoBarClosed() will be called and | 128 // completely closed (i.e. InfobarDelegate::InfoBarClosed() will be called and |
| 124 // we'll get a callback to removeController). Other infobars will simply stop | 129 // we'll get a callback to removeController). Other infobars will simply stop |
| 125 // animating and disappear. Callers must call positionInfoBarsAndRedraw() | 130 // animating and disappear. Callers must call positionInfoBarsAndRedraw() |
| 126 // after calling this method. | 131 // after calling this method. |
| 127 - (void)removeAllInfoBars; | 132 - (void)removeAllInfoBars; |
| 128 | 133 |
| 129 @end | 134 @end |
| 130 | 135 |
| 131 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_CONTAINER_CONTROLLER_H_ | 136 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_CONTAINER_CONTROLLER_H_ |
| OLD | NEW |