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 | 10 |
11 InfoBar* InfoBarManager::AddInfoBar(scoped_ptr<InfoBar> infobar) { | 11 InfoBar* InfoBarManager::AddInfoBar(scoped_ptr<InfoBar> infobar) { |
12 DCHECK(infobar); | 12 DCHECK(infobar); |
13 if (!infobars_enabled_) | 13 if (!infobars_enabled_) |
14 return NULL; | 14 return NULL; |
15 | 15 |
16 for (InfoBars::const_iterator i(infobars_.begin()); i != infobars_.end(); | 16 for (InfoBars::const_iterator i(infobars_.begin()); i != infobars_.end(); |
17 ++i) { | 17 ++i) { |
18 if ((*i)->delegate()->EqualsDelegate(infobar->delegate())) { | 18 if ((*i)->delegate()->EqualsDelegate(infobar->delegate())) { |
19 DCHECK_NE((*i)->delegate(), infobar->delegate()); | 19 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 | 128 // 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. | 129 // AddInfoBar() or similar, we don't dupe-check against this infobar. |
130 infobars_.erase(i); | 130 infobars_.erase(i); |
131 | 131 |
132 // This notification must happen before the call to CloseSoon() below, since | 132 // This notification must happen before the call to CloseSoon() below, since |
133 // observers may want to access |infobar| and that call can delete it. | 133 // observers may want to access |infobar| and that call can delete it. |
134 NotifyInfoBarRemoved(infobar, animate); | 134 NotifyInfoBarRemoved(infobar, animate); |
135 | 135 |
136 infobar->CloseSoon(); | 136 infobar->CloseSoon(); |
137 } | 137 } |
OLD | NEW |