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 "chrome/browser/infobars/infobar_manager.h" | 5 #include "components/infobars/core/infobar_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/infobars/infobar.h" | 8 #include "components/infobars/core/infobar.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "components/infobars/core/infobars_switches.h" |
| 10 |
| 11 namespace infobars { |
10 | 12 |
11 InfoBar* InfoBarManager::AddInfoBar(scoped_ptr<InfoBar> infobar) { | 13 InfoBar* InfoBarManager::AddInfoBar(scoped_ptr<InfoBar> infobar) { |
12 DCHECK(infobar); | 14 DCHECK(infobar); |
13 if (!infobars_enabled_) | 15 if (!infobars_enabled_) |
14 return NULL; | 16 return NULL; |
15 | 17 |
16 for (InfoBars::const_iterator i(infobars_.begin()); i != infobars_.end(); | 18 for (InfoBars::const_iterator i(infobars_.begin()); i != infobars_.end(); |
17 ++i) { | 19 ++i) { |
18 if ((*i)->delegate()->EqualsDelegate(infobar->delegate())) { | 20 if ((*i)->delegate()->EqualsDelegate(infobar->delegate())) { |
19 DCHECK_NE((*i)->delegate(), infobar->delegate()); | 21 DCHECK_NE((*i)->delegate(), infobar->delegate()); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Remove the infobar before notifying, so that if any observers call back to | 130 // Remove the infobar before notifying, so that if any observers call back to |
129 // AddInfoBar() or similar, we don't dupe-check against this infobar. | 131 // AddInfoBar() or similar, we don't dupe-check against this infobar. |
130 infobars_.erase(i); | 132 infobars_.erase(i); |
131 | 133 |
132 // This notification must happen before the call to CloseSoon() below, since | 134 // This notification must happen before the call to CloseSoon() below, since |
133 // observers may want to access |infobar| and that call can delete it. | 135 // observers may want to access |infobar| and that call can delete it. |
134 NotifyInfoBarRemoved(infobar, animate); | 136 NotifyInfoBarRemoved(infobar, animate); |
135 | 137 |
136 infobar->CloseSoon(); | 138 infobar->CloseSoon(); |
137 } | 139 } |
| 140 |
| 141 } // namespace infobars |
OLD | NEW |