OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/browser_list.h" | 5 #include "chrome/browser/ui/browser_list.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 browsers_to_close, | 156 browsers_to_close, |
157 on_close_success, | 157 on_close_success, |
158 profile_path))) { | 158 profile_path))) { |
159 return; | 159 return; |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 on_close_success.Run(profile_path); | 163 on_close_success.Run(profile_path); |
164 | 164 |
165 for (BrowserVector::const_iterator it = browsers_to_close.begin(); | 165 for (BrowserVector::const_iterator it = browsers_to_close.begin(); |
166 it != browsers_to_close.end(); ++it) | 166 it != browsers_to_close.end(); ++it) { |
167 (*it)->window()->Close(); | 167 if (*it && (*it)->window()) |
Peter Kasting
2014/10/29 18:07:01
Can both these be NULL, or just one?
Why do we ne
Mike Lerman
2014/10/29 18:26:06
I don't know what scenario is causing the NULLs un
| |
168 (*it)->window()->Close(); | |
169 } | |
168 } | 170 } |
169 | 171 |
170 // static | 172 // static |
171 void BrowserList::PostBeforeUnloadHandlers( | 173 void BrowserList::PostBeforeUnloadHandlers( |
172 const BrowserVector& browsers_to_close, | 174 const BrowserVector& browsers_to_close, |
173 const base::Callback<void(const base::FilePath&)>& on_close_success, | 175 const base::Callback<void(const base::FilePath&)>& on_close_success, |
174 const base::FilePath& profile_path, | 176 const base::FilePath& profile_path, |
175 bool tab_close_confirmed) { | 177 bool tab_close_confirmed) { |
176 // We need this bool to avoid infinite recursion when resetting the | 178 // We need this bool to avoid infinite recursion when resetting the |
177 // BeforeUnload handlers, since doing that will trigger calls back to this | 179 // BeforeUnload handlers, since doing that will trigger calls back to this |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 } | 235 } |
234 | 236 |
235 // static | 237 // static |
236 void BrowserList::RemoveBrowserFrom(Browser* browser, | 238 void BrowserList::RemoveBrowserFrom(Browser* browser, |
237 BrowserVector* browser_list) { | 239 BrowserVector* browser_list) { |
238 BrowserVector::iterator remove_browser = | 240 BrowserVector::iterator remove_browser = |
239 std::find(browser_list->begin(), browser_list->end(), browser); | 241 std::find(browser_list->begin(), browser_list->end(), browser); |
240 if (remove_browser != browser_list->end()) | 242 if (remove_browser != browser_list->end()) |
241 browser_list->erase(remove_browser); | 243 browser_list->erase(remove_browser); |
242 } | 244 } |
OLD | NEW |