| 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" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/browser_shutdown.h" | 12 #include "chrome/browser/browser_shutdown.h" |
| 13 #include "chrome/browser/browser_window.h" | 13 #include "chrome/browser/browser_window.h" |
| 14 #include "chrome/browser/profile_manager.h" | 14 #include "chrome/browser/profile_manager.h" |
| 15 #include "chrome/browser/renderer_host/render_process_host.h" | 15 #include "chrome/browser/renderer_host/render_process_host.h" |
| 16 #include "chrome/browser/tab_contents/navigation_controller.h" | 16 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 17 #include "chrome/common/notification_registrar.h" | 17 #include "chrome/common/notification_registrar.h" |
| 18 #include "chrome/common/notification_service.h" | 18 #include "chrome/common/notification_service.h" |
| 19 #include "chrome/common/result_codes.h" | 19 #include "chrome/common/result_codes.h" |
| 20 | 20 |
| 21 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) |
| 22 #include "chrome/browser/chrome_application_mac.h" | 22 #include "chrome/browser/chrome_browser_application_mac.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 // This object is instantiated when the first Browser object is added to the | 27 // This object is instantiated when the first Browser object is added to the |
| 28 // list and delete when the last one is removed. It watches for loads and | 28 // list and delete when the last one is removed. It watches for loads and |
| 29 // creates histograms of some global object counts. | 29 // creates histograms of some global object counts. |
| 30 class BrowserActivityObserver : public NotificationObserver { | 30 class BrowserActivityObserver : public NotificationObserver { |
| 31 public: | 31 public: |
| 32 BrowserActivityObserver() { | 32 BrowserActivityObserver() { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 231 |
| 232 // static | 232 // static |
| 233 void BrowserList::CloseAllBrowsersAndExit() { | 233 void BrowserList::CloseAllBrowsersAndExit() { |
| 234 #if !defined(OS_MACOSX) | 234 #if !defined(OS_MACOSX) |
| 235 // On most platforms, closing all windows causes the application to exit. | 235 // On most platforms, closing all windows causes the application to exit. |
| 236 CloseAllBrowsers(true); | 236 CloseAllBrowsers(true); |
| 237 #else | 237 #else |
| 238 // On the Mac, the application continues to run once all windows are closed. | 238 // On the Mac, the application continues to run once all windows are closed. |
| 239 // Terminate will result in a CloseAllBrowsers(true) call, and additionally, | 239 // Terminate will result in a CloseAllBrowsers(true) call, and additionally, |
| 240 // will cause the application to exit cleanly. | 240 // will cause the application to exit cleanly. |
| 241 CrApplicationCC::Terminate(); | 241 chrome_browser_application_mac::Terminate(); |
| 242 #endif | 242 #endif |
| 243 } | 243 } |
| 244 | 244 |
| 245 // static | 245 // static |
| 246 void BrowserList::WindowsSessionEnding() { | 246 void BrowserList::WindowsSessionEnding() { |
| 247 // EndSession is invoked once per frame. Only do something the first time. | 247 // EndSession is invoked once per frame. Only do something the first time. |
| 248 static bool already_ended = false; | 248 static bool already_ended = false; |
| 249 if (already_ended) | 249 if (already_ended) |
| 250 return; | 250 return; |
| 251 already_ended = true; | 251 already_ended = true; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 } | 406 } |
| 407 | 407 |
| 408 TabContents* next_tab = | 408 TabContents* next_tab = |
| 409 (*browser_iterator_)->GetTabContentsAt(web_view_index_); | 409 (*browser_iterator_)->GetTabContentsAt(web_view_index_); |
| 410 if (next_tab) { | 410 if (next_tab) { |
| 411 cur_ = next_tab; | 411 cur_ = next_tab; |
| 412 return; | 412 return; |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 } | 415 } |
| OLD | NEW |