| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/devtools/global_confirm_info_bar.h" | 5 #include "chrome/browser/devtools/global_confirm_info_bar.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 void GlobalConfirmInfoBar::Close() { | 141 void GlobalConfirmInfoBar::Close() { |
| 142 delete this; | 142 delete this; |
| 143 } | 143 } |
| 144 | 144 |
| 145 GlobalConfirmInfoBar::GlobalConfirmInfoBar( | 145 GlobalConfirmInfoBar::GlobalConfirmInfoBar( |
| 146 std::unique_ptr<ConfirmInfoBarDelegate> delegate) | 146 std::unique_ptr<ConfirmInfoBarDelegate> delegate) |
| 147 : delegate_(std::move(delegate)), | 147 : delegate_(std::move(delegate)), |
| 148 browser_tab_strip_tracker_(this, nullptr, nullptr), | 148 browser_tab_strip_tracker_(this, nullptr, nullptr), |
| 149 weak_factory_(this) { | 149 weak_factory_(this) { |
| 150 browser_tab_strip_tracker_.Init( | 150 browser_tab_strip_tracker_.Init(); |
| 151 BrowserTabStripTracker::InitWith::BROWSERS_IN_ACTIVE_DESKTOP); | |
| 152 } | 151 } |
| 153 | 152 |
| 154 GlobalConfirmInfoBar::~GlobalConfirmInfoBar() { | 153 GlobalConfirmInfoBar::~GlobalConfirmInfoBar() { |
| 155 while (!proxies_.empty()) { | 154 while (!proxies_.empty()) { |
| 156 auto it = proxies_.begin(); | 155 auto it = proxies_.begin(); |
| 157 it->second->Detach(); | 156 it->second->Detach(); |
| 158 it->first->RemoveObserver(this); | 157 it->first->RemoveObserver(this); |
| 159 it->first->RemoveInfoBar(it->second->info_bar_); | 158 it->first->RemoveInfoBar(it->second->info_bar_); |
| 160 proxies_.erase(it); | 159 proxies_.erase(it); |
| 161 } | 160 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 new GlobalConfirmInfoBar::DelegateProxy(weak_factory_.GetWeakPtr())); | 202 new GlobalConfirmInfoBar::DelegateProxy(weak_factory_.GetWeakPtr())); |
| 204 GlobalConfirmInfoBar::DelegateProxy* proxy_ptr = proxy.get(); | 203 GlobalConfirmInfoBar::DelegateProxy* proxy_ptr = proxy.get(); |
| 205 infobars::InfoBar* added_bar = infobar_service->AddInfoBar( | 204 infobars::InfoBar* added_bar = infobar_service->AddInfoBar( |
| 206 infobar_service->CreateConfirmInfoBar(std::move(proxy))); | 205 infobar_service->CreateConfirmInfoBar(std::move(proxy))); |
| 207 | 206 |
| 208 proxy_ptr->info_bar_ = added_bar; | 207 proxy_ptr->info_bar_ = added_bar; |
| 209 DCHECK(added_bar); | 208 DCHECK(added_bar); |
| 210 proxies_[infobar_service] = proxy_ptr; | 209 proxies_[infobar_service] = proxy_ptr; |
| 211 infobar_service->AddObserver(this); | 210 infobar_service->AddObserver(this); |
| 212 } | 211 } |
| OLD | NEW |