OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/histogram.h" | 7 #include "base/histogram.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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // We should never get here. | 228 // We should never get here. |
229 NOTREACHED(); | 229 NOTREACHED(); |
230 return; | 230 return; |
231 } | 231 } |
232 } | 232 } |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 // static | 236 // static |
237 void BrowserList::CloseAllBrowsersAndExit() { | 237 void BrowserList::CloseAllBrowsersAndExit() { |
| 238 NotificationService::current()->Notify( |
| 239 NotificationType::APP_EXITING, |
| 240 NotificationService::AllSources(), |
| 241 NotificationService::NoDetails()); |
| 242 |
238 #if !defined(OS_MACOSX) | 243 #if !defined(OS_MACOSX) |
239 // On most platforms, closing all windows causes the application to exit. | 244 // On most platforms, closing all windows causes the application to exit. |
240 CloseAllBrowsers(true); | 245 CloseAllBrowsers(true); |
241 #else | 246 #else |
242 // On the Mac, the application continues to run once all windows are closed. | 247 // On the Mac, the application continues to run once all windows are closed. |
243 // Terminate will result in a CloseAllBrowsers(true) call, and additionally, | 248 // Terminate will result in a CloseAllBrowsers(true) call, and additionally, |
244 // will cause the application to exit cleanly. | 249 // will cause the application to exit cleanly. |
245 chrome_browser_application_mac::Terminate(); | 250 chrome_browser_application_mac::Terminate(); |
246 #endif | 251 #endif |
247 } | 252 } |
248 | 253 |
249 // static | 254 // static |
250 void BrowserList::WindowsSessionEnding() { | 255 void BrowserList::WindowsSessionEnding() { |
251 // EndSession is invoked once per frame. Only do something the first time. | 256 // EndSession is invoked once per frame. Only do something the first time. |
252 static bool already_ended = false; | 257 static bool already_ended = false; |
253 if (already_ended) | 258 if (already_ended) |
254 return; | 259 return; |
255 already_ended = true; | 260 already_ended = true; |
256 | 261 |
257 browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION); | 262 browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION); |
258 | 263 |
| 264 NotificationService::current()->Notify( |
| 265 NotificationType::APP_EXITING, |
| 266 NotificationService::AllSources(), |
| 267 NotificationService::NoDetails()); |
| 268 |
259 // Write important data first. | 269 // Write important data first. |
260 g_browser_process->EndSession(); | 270 g_browser_process->EndSession(); |
261 | 271 |
262 // Close all the browsers. | 272 // Close all the browsers. |
263 BrowserList::CloseAllBrowsers(false); | 273 BrowserList::CloseAllBrowsers(false); |
264 | 274 |
265 // Send out notification. This is used during testing so that the test harness | 275 // Send out notification. This is used during testing so that the test harness |
266 // can properly shutdown before we exit. | 276 // can properly shutdown before we exit. |
267 NotificationService::current()->Notify( | 277 NotificationService::current()->Notify( |
268 NotificationType::SESSION_END, | 278 NotificationType::SESSION_END, |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 422 } |
413 | 423 |
414 TabContents* next_tab = | 424 TabContents* next_tab = |
415 (*browser_iterator_)->GetTabContentsAt(web_view_index_); | 425 (*browser_iterator_)->GetTabContentsAt(web_view_index_); |
416 if (next_tab) { | 426 if (next_tab) { |
417 cur_ = next_tab; | 427 cur_ = next_tab; |
418 return; | 428 return; |
419 } | 429 } |
420 } | 430 } |
421 } | 431 } |
OLD | NEW |