summaryrefslogtreecommitdiffstats
path: root/ios/chrome/browser/infobars/infobar_utils.mm
blob: f3e9a0b28618a96e1c62ba827ef564089a308024 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright 2014 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.

#include "ios/chrome/browser/infobars/infobar_utils.h"

#include <utility>

#include "base/mac/scoped_nsobject.h"
#include "base/memory/scoped_ptr.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
#include "ios/chrome/browser/infobars/confirm_infobar_controller.h"
#include "ios/chrome/browser/infobars/infobar.h"

scoped_ptr<infobars::InfoBar> CreateConfirmInfoBar(
    scoped_ptr<ConfirmInfoBarDelegate> delegate) {
  scoped_ptr<InfoBarIOS> infobar(new InfoBarIOS(std::move(delegate)));
  base::scoped_nsobject<ConfirmInfoBarController> controller(
      [[ConfirmInfoBarController alloc] initWithDelegate:infobar.get()]);
  infobar->SetController(controller);
  return std::move(infobar);
}