OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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.h" | 5 #include "ios/chrome/browser/infobars/infobar.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "components/infobars/core/confirm_infobar_delegate.h" | 10 #include "components/infobars/core/confirm_infobar_delegate.h" |
9 #include "components/translate/core/browser/translate_infobar_delegate.h" | 11 #include "components/translate/core/browser/translate_infobar_delegate.h" |
10 #import "ios/chrome/browser/infobars/confirm_infobar_controller.h" | 12 #import "ios/chrome/browser/infobars/confirm_infobar_controller.h" |
11 #include "ios/chrome/browser/infobars/infobar_controller.h" | 13 #include "ios/chrome/browser/infobars/infobar_controller.h" |
12 #include "ios/chrome/browser/translate/translate_infobar_tags.h" | 14 #include "ios/chrome/browser/translate/translate_infobar_tags.h" |
13 | 15 |
14 using infobars::InfoBar; | 16 using infobars::InfoBar; |
15 using infobars::InfoBarDelegate; | 17 using infobars::InfoBarDelegate; |
16 | 18 |
17 InfoBarIOS::InfoBarIOS(scoped_ptr<InfoBarDelegate> delegate) | 19 InfoBarIOS::InfoBarIOS(scoped_ptr<InfoBarDelegate> delegate) |
18 : InfoBar(delegate.Pass()) { | 20 : InfoBar(std::move(delegate)) {} |
19 } | |
20 | 21 |
21 InfoBarIOS::~InfoBarIOS() { | 22 InfoBarIOS::~InfoBarIOS() { |
22 DCHECK(controller_); | 23 DCHECK(controller_); |
23 [controller_ detachView]; | 24 [controller_ detachView]; |
24 controller_.reset(); | 25 controller_.reset(); |
25 } | 26 } |
26 | 27 |
27 void InfoBarIOS::SetController(InfoBarController* controller) { | 28 void InfoBarIOS::SetController(InfoBarController* controller) { |
28 controller_.reset([controller retain]); | 29 controller_.reset([controller retain]); |
29 } | 30 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 115 } |
115 } | 116 } |
116 | 117 |
117 void InfoBarIOS::InfoBarDidCancel() { | 118 void InfoBarIOS::InfoBarDidCancel() { |
118 // If not owned, the infobar has already been removed. | 119 // If not owned, the infobar has already been removed. |
119 if (!owner()) | 120 if (!owner()) |
120 return; | 121 return; |
121 delegate()->InfoBarDismissed(); | 122 delegate()->InfoBarDismissed(); |
122 RemoveSelf(); | 123 RemoveSelf(); |
123 } | 124 } |
OLD | NEW |