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