OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "ios/chrome/browser/infobars/infobar_utils.h" | 5 #include "ios/chrome/browser/infobars/infobar_utils.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | |
11 #include "components/infobars/core/confirm_infobar_delegate.h" | 10 #include "components/infobars/core/confirm_infobar_delegate.h" |
12 #include "ios/chrome/browser/infobars/confirm_infobar_controller.h" | 11 #include "ios/chrome/browser/infobars/confirm_infobar_controller.h" |
13 #include "ios/chrome/browser/infobars/infobar.h" | 12 #include "ios/chrome/browser/infobars/infobar.h" |
14 | 13 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." |
| 16 #endif |
| 17 |
15 std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar( | 18 std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar( |
16 std::unique_ptr<ConfirmInfoBarDelegate> delegate) { | 19 std::unique_ptr<ConfirmInfoBarDelegate> delegate) { |
17 std::unique_ptr<InfoBarIOS> infobar(new InfoBarIOS(std::move(delegate))); | 20 std::unique_ptr<InfoBarIOS> infobar(new InfoBarIOS(std::move(delegate))); |
18 base::scoped_nsobject<ConfirmInfoBarController> controller( | 21 ConfirmInfoBarController* controller = |
19 [[ConfirmInfoBarController alloc] initWithDelegate:infobar.get()]); | 22 [[ConfirmInfoBarController alloc] initWithDelegate:infobar.get()]; |
20 infobar->SetController(controller); | 23 infobar->SetController(controller); |
21 return std::move(infobar); | 24 return std::move(infobar); |
22 } | 25 } |
OLD | NEW |