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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "components/infobars/core/infobar.h" | 10 #include "components/infobars/core/infobar.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 void InfoBarManager::AddObserver(Observer* obs) { | 95 void InfoBarManager::AddObserver(Observer* obs) { |
96 observer_list_.AddObserver(obs); | 96 observer_list_.AddObserver(obs); |
97 } | 97 } |
98 | 98 |
99 void InfoBarManager::RemoveObserver(Observer* obs) { | 99 void InfoBarManager::RemoveObserver(Observer* obs) { |
100 observer_list_.RemoveObserver(obs); | 100 observer_list_.RemoveObserver(obs); |
101 } | 101 } |
102 | 102 |
103 InfoBarManager::InfoBarManager() | 103 InfoBarManager::InfoBarManager() { |
104 : infobars_enabled_(true) { | |
105 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 104 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
106 switches::kDisableInfoBars)) | 105 switches::kDisableInfoBars)) |
107 infobars_enabled_ = false; | 106 infobars_enabled_ = false; |
108 } | 107 } |
109 | 108 |
110 InfoBarManager::~InfoBarManager() {} | 109 InfoBarManager::~InfoBarManager() {} |
111 | 110 |
112 void InfoBarManager::ShutDown() { | 111 void InfoBarManager::ShutDown() { |
113 // 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 |
114 // 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. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 infobars_.erase(i); | 153 infobars_.erase(i); |
155 | 154 |
156 // This notification must happen before the call to CloseSoon() below, since | 155 // This notification must happen before the call to CloseSoon() below, since |
157 // observers may want to access |infobar| and that call can delete it. | 156 // observers may want to access |infobar| and that call can delete it. |
158 NotifyInfoBarRemoved(infobar, animate); | 157 NotifyInfoBarRemoved(infobar, animate); |
159 | 158 |
160 infobar->CloseSoon(); | 159 infobar->CloseSoon(); |
161 } | 160 } |
162 | 161 |
163 } // namespace infobars | 162 } // namespace infobars |
OLD | NEW |