OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_H_ | 5 #ifndef IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_H_ |
6 #define IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_H_ | 6 #define IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_H_ |
7 | 7 |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 #include "base/mac/scoped_nsobject.h" | |
10 | 9 |
11 @protocol InfoBarViewProtocol; | 10 @protocol InfoBarViewProtocol; |
12 class InfoBarViewDelegate; | 11 class InfoBarViewDelegate; |
13 namespace infobars { | 12 namespace infobars { |
14 class InfoBarDelegate; | 13 class InfoBarDelegate; |
15 } | 14 } |
16 | 15 |
17 // InfoBar for iOS acts as a UIViewController for InfoBarView. | 16 // InfoBar for iOS acts as a UIViewController for InfoBarView. |
18 @interface InfoBarController : NSObject | 17 @interface InfoBarController : NSObject |
19 | 18 |
20 @property(nonatomic, readonly) InfoBarViewDelegate* delegate; | 19 @property(nonatomic, readonly) InfoBarViewDelegate* delegate; |
21 // Designated initializer. | 20 // Designated initializer. |
22 - (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate | 21 - (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate |
23 NS_DESIGNATED_INITIALIZER; | 22 NS_DESIGNATED_INITIALIZER; |
24 | 23 |
25 - (instancetype)init NS_UNAVAILABLE; | 24 - (instancetype)init NS_UNAVAILABLE; |
26 | 25 |
27 // Creates a view and lays out all the infobar elements in it. Will not add | 26 // Creates a view and lays out all the infobar elements in it. Will not add |
28 // it as a subview yet. This method must be overriden in subclasses. | 27 // it as a subview yet. This method must be overriden in subclasses. |
29 - (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) | 28 - (UIView<InfoBarViewProtocol>*)viewForDelegate: |
30 viewForDelegate:(infobars::InfoBarDelegate*)delegate | 29 (infobars::InfoBarDelegate*)delegate |
31 frame:(CGRect)bounds; | 30 frame:(CGRect)bounds; |
32 | 31 |
33 // Creates the view. | 32 // Creates the view. |
34 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate | 33 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate |
35 frame:(CGRect)bounds; | 34 frame:(CGRect)bounds; |
36 | 35 |
37 // Detaches view from its delegate. | 36 // Detaches view from its delegate. |
38 // After this function is called, no user interaction can be handled. | 37 // After this function is called, no user interaction can be handled. |
39 - (void)detachView; | 38 - (void)detachView; |
40 | 39 |
41 // Returns the actual height in pixels of this infobar instance. | 40 // Returns the actual height in pixels of this infobar instance. |
42 - (int)barHeight; | 41 - (int)barHeight; |
43 | 42 |
44 // Adjusts visible portion of this infobar. | 43 // Adjusts visible portion of this infobar. |
45 - (void)onHeightsRecalculated:(int)newHeight; | 44 - (void)onHeightsRecalculated:(int)newHeight; |
46 | 45 |
47 // Removes the view. | 46 // Removes the view. |
48 - (void)removeView; | 47 - (void)removeView; |
49 | 48 |
50 // Accesses the view. | 49 // Accesses the view. |
51 - (UIView<InfoBarViewProtocol>*)view; | 50 - (UIView<InfoBarViewProtocol>*)view; |
52 | 51 |
53 @end | 52 @end |
54 | 53 |
55 #endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_H_ | 54 #endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_H_ |
OLD | NEW |