| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void MarkAsCleanShutdown() { | 77 void MarkAsCleanShutdown() { |
| 78 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles() instead? | 78 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles() instead? |
| 79 for (BrowserList::const_iterator i = BrowserList::begin(); | 79 for (BrowserList::const_iterator i = BrowserList::begin(); |
| 80 i != BrowserList::end(); ++i) { | 80 i != BrowserList::end(); ++i) { |
| 81 (*i)->profile()->MarkAsCleanShutdown(); | 81 (*i)->profile()->MarkAsCleanShutdown(); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 void AttemptExitInternal() { | 85 void AttemptExitInternal() { |
| 86 content::NotificationService::current()->Notify( | 86 content::NotificationService::current()->Notify( |
| 87 content::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 87 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
| 88 content::NotificationService::AllSources(), | 88 content::NotificationService::AllSources(), |
| 89 content::NotificationService::NoDetails()); | 89 content::NotificationService::NoDetails()); |
| 90 | 90 |
| 91 #if !defined(OS_MACOSX) | 91 #if !defined(OS_MACOSX) |
| 92 // On most platforms, closing all windows causes the application to exit. | 92 // On most platforms, closing all windows causes the application to exit. |
| 93 CloseAllBrowsers(); | 93 CloseAllBrowsers(); |
| 94 #else | 94 #else |
| 95 // On the Mac, the application continues to run once all windows are closed. | 95 // On the Mac, the application continues to run once all windows are closed. |
| 96 // Terminate will result in a CloseAllBrowsers() call, and once (and if) | 96 // Terminate will result in a CloseAllBrowsers() call, and once (and if) |
| 97 // that is done, will cause the application to exit cleanly. | 97 // that is done, will cause the application to exit cleanly. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 static bool already_ended = false; | 306 static bool already_ended = false; |
| 307 // We may get called in the middle of shutdown, e.g. http://crbug.com/70852 | 307 // We may get called in the middle of shutdown, e.g. http://crbug.com/70852 |
| 308 // In this case, do nothing. | 308 // In this case, do nothing. |
| 309 if (already_ended || !content::NotificationService::current()) | 309 if (already_ended || !content::NotificationService::current()) |
| 310 return; | 310 return; |
| 311 already_ended = true; | 311 already_ended = true; |
| 312 | 312 |
| 313 browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION); | 313 browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION); |
| 314 | 314 |
| 315 content::NotificationService::current()->Notify( | 315 content::NotificationService::current()->Notify( |
| 316 content::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 316 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
| 317 content::NotificationService::AllSources(), | 317 content::NotificationService::AllSources(), |
| 318 content::NotificationService::NoDetails()); | 318 content::NotificationService::NoDetails()); |
| 319 | 319 |
| 320 // Write important data first. | 320 // Write important data first. |
| 321 g_browser_process->EndSession(); | 321 g_browser_process->EndSession(); |
| 322 | 322 |
| 323 CloseAllBrowsers(); | 323 CloseAllBrowsers(); |
| 324 | 324 |
| 325 // Send out notification. This is used during testing so that the test harness | 325 // Send out notification. This is used during testing so that the test harness |
| 326 // can properly shutdown before we exit. | 326 // can properly shutdown before we exit. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 MessageLoop::current()) | 360 MessageLoop::current()) |
| 361 CloseAllBrowsers(); | 361 CloseAllBrowsers(); |
| 362 } | 362 } |
| 363 } | 363 } |
| 364 | 364 |
| 365 bool WillKeepAlive() { | 365 bool WillKeepAlive() { |
| 366 return g_keep_alive_count > 0; | 366 return g_keep_alive_count > 0; |
| 367 } | 367 } |
| 368 | 368 |
| 369 } // namespace browser | 369 } // namespace browser |
| OLD | NEW |