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 #include "components/infobars/core/infobar_delegate.h"
11 #include "ios/chrome/browser/infobars/infobar_controller.h"
12 #import "ios/public/provider/chrome/browser/ui/infobar_view_delegate.h"
14 // InfoBar for iOS acts as a UIViewController for InfoBarView.
15 class InfoBarIOS
: public infobars::InfoBar
, public InfoBarViewDelegate
{
17 explicit InfoBarIOS(scoped_ptr
<infobars::InfoBarDelegate
> delegate
);
18 ~InfoBarIOS() override
;
20 // Layouts the infobar using data from delegate and prepare it for adding to
22 void Layout(CGRect container_bounds
);
24 // Returns UIView holding content of this infobar.
27 // Remove the infobar view from infobar container view.
30 // Sets the controller. Should be called right after the infobar's creation.
31 void SetController(InfoBarController
* controller
);
35 void PlatformSpecificOnHeightsRecalculated() override
;
37 // InfoBarViewDelegate:
38 void SetInfoBarTargetHeight(int height
) override
;
39 void InfoBarDidCancel() override
;
40 void InfoBarButtonDidPress(NSUInteger button_id
) override
;
42 base::scoped_nsobject
<InfoBarController
> controller_
;
43 DISALLOW_COPY_AND_ASSIGN(InfoBarIOS
);
46 #endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_H_