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 | |
10 #include "base/basictypes.h" | |
11 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "components/infobars/core/infobar.h" | |
14 | 10 |
15 @protocol InfoBarViewProtocol; | 11 @protocol InfoBarViewProtocol; |
16 class InfoBarViewDelegate; | 12 class InfoBarViewDelegate; |
| 13 namespace infobars { |
| 14 class InfoBarDelegate; |
| 15 } |
17 | 16 |
18 // InfoBar for iOS acts as a UIViewController for InfoBarView. | 17 // InfoBar for iOS acts as a UIViewController for InfoBarView. |
19 @interface InfoBarController : NSObject { | 18 @interface InfoBarController : NSObject |
20 @protected | 19 |
21 base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView_; | 20 @property(nonatomic, readonly) InfoBarViewDelegate* delegate; |
22 __weak InfoBarViewDelegate* delegate_; | 21 |
23 } | 22 // Designated initializer. |
| 23 - (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate |
| 24 NS_DESIGNATED_INITIALIZER; |
24 | 25 |
25 // 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 |
26 // 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. |
| 28 - (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) |
| 29 viewForDelegate:(infobars::InfoBarDelegate*)delegate |
| 30 frame:(CGRect)bounds; |
| 31 |
| 32 // Creates the view. |
27 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate | 33 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate |
28 frame:(CGRect)bounds; | 34 frame:(CGRect)bounds; |
29 | 35 |
30 // Designated initializer. | |
31 - (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate; | |
32 | |
33 // Detaches view from its delegate. | 36 // Detaches view from its delegate. |
34 // After this function is called, no user interaction can be handled. | 37 // After this function is called, no user interaction can be handled. |
35 - (void)detachView; | 38 - (void)detachView; |
36 | 39 |
37 // Returns the actual height in pixels of this infobar instance. | 40 // Returns the actual height in pixels of this infobar instance. |
38 - (int)barHeight; | 41 - (int)barHeight; |
39 | 42 |
40 // Adjusts visible portion of this infobar. | 43 // Adjusts visible portion of this infobar. |
41 - (void)onHeightsRecalculated:(int)newHeight; | 44 - (void)onHeightsRecalculated:(int)newHeight; |
42 | 45 |
43 // Removes the view. | 46 // Removes the view. |
44 - (void)removeView; | 47 - (void)removeView; |
45 | 48 |
46 // Accesses the view. | 49 // Accesses the view. |
47 - (UIView*)view; | 50 - (UIView<InfoBarViewProtocol>*)view; |
48 | 51 |
49 @end | 52 @end |
50 | 53 |
51 #endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_H_ | 54 #endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_H_ |
OLD | NEW |