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_H_ | 5 #ifndef IOS_CHROME_BROWSER_INFOBARS_INFOBAR_H_ |
6 #define IOS_CHROME_BROWSER_INFOBARS_INFOBAR_H_ | 6 #define IOS_CHROME_BROWSER_INFOBARS_INFOBAR_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "components/infobars/core/infobar.h" | 12 #include "components/infobars/core/infobar.h" |
11 #import "ios/public/provider/chrome/browser/ui/infobar_view_delegate.h" | 13 #import "ios/public/provider/chrome/browser/ui/infobar_view_delegate.h" |
12 | 14 |
13 @class InfoBarController; | 15 @class InfoBarController; |
14 @class UIView; | 16 @class UIView; |
15 namespace infobars { | 17 namespace infobars { |
16 class InfoBarDelegate; | 18 class InfoBarDelegate; |
17 } | 19 } |
18 | 20 |
19 // InfoBar for iOS acts as a UIViewController for InfoBarView. | 21 // InfoBar for iOS acts as a UIViewController for InfoBarView. |
20 class InfoBarIOS : public infobars::InfoBar, public InfoBarViewDelegate { | 22 class InfoBarIOS : public infobars::InfoBar, public InfoBarViewDelegate { |
21 public: | 23 public: |
22 explicit InfoBarIOS(scoped_ptr<infobars::InfoBarDelegate> delegate); | 24 explicit InfoBarIOS(std::unique_ptr<infobars::InfoBarDelegate> delegate); |
23 ~InfoBarIOS() override; | 25 ~InfoBarIOS() override; |
24 | 26 |
25 // Layouts the infobar using data from delegate and prepare it for adding to | 27 // Layouts the infobar using data from delegate and prepare it for adding to |
26 // superview. | 28 // superview. |
27 void Layout(CGRect container_bounds); | 29 void Layout(CGRect container_bounds); |
28 | 30 |
29 // Returns UIView holding content of this infobar. | 31 // Returns UIView holding content of this infobar. |
30 UIView* view(); | 32 UIView* view(); |
31 | 33 |
32 // Remove the infobar view from infobar container view. | 34 // Remove the infobar view from infobar container view. |
33 void RemoveView(); | 35 void RemoveView(); |
34 | 36 |
35 // Sets the controller. Should be called right after the infobar's creation. | 37 // Sets the controller. Should be called right after the infobar's creation. |
36 void SetController(InfoBarController* controller); | 38 void SetController(InfoBarController* controller); |
37 | 39 |
38 private: | 40 private: |
39 // InfoBar overrides: | 41 // InfoBar overrides: |
40 void PlatformSpecificOnHeightsRecalculated() override; | 42 void PlatformSpecificOnHeightsRecalculated() override; |
41 | 43 |
42 // InfoBarViewDelegate: | 44 // InfoBarViewDelegate: |
43 void SetInfoBarTargetHeight(int height) override; | 45 void SetInfoBarTargetHeight(int height) override; |
44 void InfoBarDidCancel() override; | 46 void InfoBarDidCancel() override; |
45 void InfoBarButtonDidPress(NSUInteger button_id) override; | 47 void InfoBarButtonDidPress(NSUInteger button_id) override; |
46 | 48 |
47 base::scoped_nsobject<InfoBarController> controller_; | 49 base::scoped_nsobject<InfoBarController> controller_; |
48 DISALLOW_COPY_AND_ASSIGN(InfoBarIOS); | 50 DISALLOW_COPY_AND_ASSIGN(InfoBarIOS); |
49 }; | 51 }; |
50 | 52 |
51 #endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_H_ | 53 #endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_H_ |
OLD | NEW |