Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / chrome / browser / infobars / infobar.h
blob2bc401b9872f9ea9b795bd8fc1efd231f7be203e
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
3 // found in the LICENSE file.
5 #ifndef IOS_CHROME_BROWSER_INFOBARS_INFOBAR_H_
6 #define IOS_CHROME_BROWSER_INFOBARS_INFOBAR_H_
8 #include "base/mac/scoped_nsobject.h"
9 #include "components/infobars/core/infobar.h"
10 #import "ios/public/provider/chrome/browser/ui/infobar_view_delegate.h"
12 @class InfoBarController;
13 @class UIView;
14 namespace infobars {
15 class InfoBarDelegate;
18 // InfoBar for iOS acts as a UIViewController for InfoBarView.
19 class InfoBarIOS : public infobars::InfoBar, public InfoBarViewDelegate {
20 public:
21 explicit InfoBarIOS(scoped_ptr<infobars::InfoBarDelegate> delegate);
22 ~InfoBarIOS() override;
24 // Layouts the infobar using data from delegate and prepare it for adding to
25 // superview.
26 void Layout(CGRect container_bounds);
28 // Returns UIView holding content of this infobar.
29 UIView* view();
31 // Remove the infobar view from infobar container view.
32 void RemoveView();
34 // Sets the controller. Should be called right after the infobar's creation.
35 void SetController(InfoBarController* controller);
37 private:
38 // InfoBar overrides:
39 void PlatformSpecificOnHeightsRecalculated() override;
41 // InfoBarViewDelegate:
42 void SetInfoBarTargetHeight(int height) override;
43 void InfoBarDidCancel() override;
44 void InfoBarButtonDidPress(NSUInteger button_id) override;
46 base::scoped_nsobject<InfoBarController> controller_;
47 DISALLOW_COPY_AND_ASSIGN(InfoBarIOS);
50 #endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_H_