summaryrefslogtreecommitdiffstats
path: root/ios/chrome/browser/infobars/infobar_container_ios.h
blob: e54bb4b05a435d386cd727d913934faa9d95e8b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTAINER_IOS_H_
#define IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTAINER_IOS_H_

#include "components/infobars/core/infobar_container.h"

#include <stddef.h>

#include "base/mac/scoped_nsobject.h"
#include "base/macros.h"

@class InfoBarContainerView;
class InfoBarIOS;

// IOS infobar container specialization, managing infobars visibility so
// that only the front most one is visible at any time.
class InfoBarContainerIOS : public infobars::InfoBarContainer {
 public:
  explicit InfoBarContainerIOS(infobars::InfoBarContainer::Delegate* delegate);
  ~InfoBarContainerIOS() override;

  // Returns the UIView container.
  InfoBarContainerView* view();

  // Hides the current infobar keeping the current state. If a new infobar is
  // added, it will be hidden as well.
  void SuspendInfobars();

  // Restores the normal behavior of the infobars.
  void RestoreInfobars();

 protected:
  void PlatformSpecificAddInfoBar(infobars::InfoBar* infobar,
                                  size_t position) override;
  void PlatformSpecificRemoveInfoBar(infobars::InfoBar* infobar) override;
  void PlatformSpecificInfoBarStateChanged(bool is_animating) override;

 private:
  base::scoped_nsobject<InfoBarContainerView> container_view_;
  InfoBarContainer::Delegate* delegate_;

  DISALLOW_COPY_AND_ASSIGN(InfoBarContainerIOS);
};

#endif  // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTAINER_IOS_H_