| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_list.h" | 5 #include "chrome/browser/browser_list.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 // Terminate will result in a CloseAllBrowsers() call, and once (and if) | 386 // Terminate will result in a CloseAllBrowsers() call, and once (and if) |
| 387 // that is done, will cause the application to exit cleanly. | 387 // that is done, will cause the application to exit cleanly. |
| 388 chrome_browser_application_mac::Terminate(); | 388 chrome_browser_application_mac::Terminate(); |
| 389 #endif | 389 #endif |
| 390 } | 390 } |
| 391 | 391 |
| 392 // static | 392 // static |
| 393 void BrowserList::SessionEnding() { | 393 void BrowserList::SessionEnding() { |
| 394 // EndSession is invoked once per frame. Only do something the first time. | 394 // EndSession is invoked once per frame. Only do something the first time. |
| 395 static bool already_ended = false; | 395 static bool already_ended = false; |
| 396 if (already_ended) | 396 // We may get called in the middle of shutdown, e.g. http://crbug.com/70852 |
| 397 // In this case, do nothing. |
| 398 if (already_ended || !NotificationService::current()) |
| 397 return; | 399 return; |
| 398 already_ended = true; | 400 already_ended = true; |
| 399 | 401 |
| 400 browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION); | 402 browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION); |
| 401 | 403 |
| 402 NotificationService::current()->Notify( | 404 NotificationService::current()->Notify( |
| 403 NotificationType::APP_EXITING, | 405 NotificationType::APP_EXITING, |
| 404 NotificationService::AllSources(), | 406 NotificationService::AllSources(), |
| 405 NotificationService::NoDetails()); | 407 NotificationService::NoDetails()); |
| 406 | 408 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 } | 614 } |
| 613 | 615 |
| 614 TabContents* next_tab = | 616 TabContents* next_tab = |
| 615 (*browser_iterator_)->GetTabContentsAt(web_view_index_); | 617 (*browser_iterator_)->GetTabContentsAt(web_view_index_); |
| 616 if (next_tab) { | 618 if (next_tab) { |
| 617 cur_ = next_tab; | 619 cur_ = next_tab; |
| 618 return; | 620 return; |
| 619 } | 621 } |
| 620 } | 622 } |
| 621 } | 623 } |
| OLD | NEW |