| 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 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 void InfoBarManager::AddObserver(Observer* obs) { | 94 void InfoBarManager::AddObserver(Observer* obs) { |
| 95 observer_list_.AddObserver(obs); | 95 observer_list_.AddObserver(obs); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void InfoBarManager::RemoveObserver(Observer* obs) { | 98 void InfoBarManager::RemoveObserver(Observer* obs) { |
| 99 observer_list_.RemoveObserver(obs); | 99 observer_list_.RemoveObserver(obs); |
| 100 } | 100 } |
| 101 | 101 |
| 102 InfoBarManager::InfoBarManager() | 102 InfoBarManager::InfoBarManager() |
| 103 : infobars_enabled_(true) { | 103 : infobars_enabled_(true) { |
| 104 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableInfoBars)) | 104 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 105 switches::kDisableInfoBars)) |
| 105 infobars_enabled_ = false; | 106 infobars_enabled_ = false; |
| 106 } | 107 } |
| 107 | 108 |
| 108 InfoBarManager::~InfoBarManager() {} | 109 InfoBarManager::~InfoBarManager() {} |
| 109 | 110 |
| 110 void InfoBarManager::ShutDown() { | 111 void InfoBarManager::ShutDown() { |
| 111 // Destroy all remaining InfoBars. It's important to not animate here so that | 112 // Destroy all remaining InfoBars. It's important to not animate here so that |
| 112 // we guarantee that we'll delete all delegates before we do anything else. | 113 // we guarantee that we'll delete all delegates before we do anything else. |
| 113 RemoveAllInfoBars(false); | 114 RemoveAllInfoBars(false); |
| 114 FOR_EACH_OBSERVER(Observer, observer_list_, OnManagerShuttingDown(this)); | 115 FOR_EACH_OBSERVER(Observer, observer_list_, OnManagerShuttingDown(this)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 infobars_.erase(i); | 151 infobars_.erase(i); |
| 151 | 152 |
| 152 // This notification must happen before the call to CloseSoon() below, since | 153 // This notification must happen before the call to CloseSoon() below, since |
| 153 // observers may want to access |infobar| and that call can delete it. | 154 // observers may want to access |infobar| and that call can delete it. |
| 154 NotifyInfoBarRemoved(infobar, animate); | 155 NotifyInfoBarRemoved(infobar, animate); |
| 155 | 156 |
| 156 infobar->CloseSoon(); | 157 infobar->CloseSoon(); |
| 157 } | 158 } |
| 158 | 159 |
| 159 } // namespace infobars | 160 } // namespace infobars |
| OLD | NEW |