| 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 "components/infobars/core/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 "components/infobars/core/infobar.h" | 8 #include "components/infobars/core/infobar.h" |
| 9 #include "components/infobars/core/infobars_switches.h" | 9 #include "components/infobars/core/infobars_switches.h" |
| 10 | 10 |
| 11 namespace infobars { | 11 namespace infobars { |
| 12 | 12 |
| 13 |
| 14 // InfoBarManager::Observer --------------------------------------------------- |
| 15 |
| 16 void InfoBarManager::Observer::OnInfoBarAdded(InfoBar* infobar) { |
| 17 } |
| 18 |
| 19 void InfoBarManager::Observer::OnInfoBarRemoved(InfoBar* infobar, |
| 20 bool animate) { |
| 21 } |
| 22 |
| 23 void InfoBarManager::Observer::OnInfoBarReplaced(InfoBar* old_infobar, |
| 24 InfoBar* new_infobar) { |
| 25 } |
| 26 |
| 27 void InfoBarManager::Observer::OnManagerShuttingDown(InfoBarManager* manager) { |
| 28 } |
| 29 |
| 30 |
| 31 // InfoBarManager -------------------------------------------------------------- |
| 32 |
| 13 InfoBar* InfoBarManager::AddInfoBar(scoped_ptr<InfoBar> infobar) { | 33 InfoBar* InfoBarManager::AddInfoBar(scoped_ptr<InfoBar> infobar) { |
| 14 DCHECK(infobar); | 34 DCHECK(infobar); |
| 15 if (!infobars_enabled_) | 35 if (!infobars_enabled_) |
| 16 return NULL; | 36 return NULL; |
| 17 | 37 |
| 18 for (InfoBars::const_iterator i(infobars_.begin()); i != infobars_.end(); | 38 for (InfoBars::const_iterator i(infobars_.begin()); i != infobars_.end(); |
| 19 ++i) { | 39 ++i) { |
| 20 if ((*i)->delegate()->EqualsDelegate(infobar->delegate())) { | 40 if ((*i)->delegate()->EqualsDelegate(infobar->delegate())) { |
| 21 DCHECK_NE((*i)->delegate(), infobar->delegate()); | 41 DCHECK_NE((*i)->delegate(), infobar->delegate()); |
| 22 return NULL; | 42 return NULL; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 infobars_.erase(i); | 152 infobars_.erase(i); |
| 133 | 153 |
| 134 // This notification must happen before the call to CloseSoon() below, since | 154 // This notification must happen before the call to CloseSoon() below, since |
| 135 // observers may want to access |infobar| and that call can delete it. | 155 // observers may want to access |infobar| and that call can delete it. |
| 136 NotifyInfoBarRemoved(infobar, animate); | 156 NotifyInfoBarRemoved(infobar, animate); |
| 137 | 157 |
| 138 infobar->CloseSoon(); | 158 infobar->CloseSoon(); |
| 139 } | 159 } |
| 140 | 160 |
| 141 } // namespace infobars | 161 } // namespace infobars |
| OLD | NEW |