| 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" |
| 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/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/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_browser_application_mac.h" | 22 #include "chrome/browser/chrome_browser_application_mac.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 #if defined(OS_CHROMEOS) | 25 #if defined(OS_CHROMEOS) |
| 26 #include "chrome/browser/chromeos/boot_times_loader.h" | 26 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 27 #include "chrome/browser/chromeos/cros/cros_library.h" | 27 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 28 #include "chrome/browser/chromeos/cros/login_library.h" | 28 #include "chrome/browser/chromeos/cros/login_library.h" |
| 29 #include "chrome/browser/chromeos/wm_ipc.h" |
| 29 #endif | 30 #endif |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| 33 // This object is instantiated when the first Browser object is added to the | 34 // This object is instantiated when the first Browser object is added to the |
| 34 // list and delete when the last one is removed. It watches for loads and | 35 // list and delete when the last one is removed. It watches for loads and |
| 35 // creates histograms of some global object counts. | 36 // creates histograms of some global object counts. |
| 36 class BrowserActivityObserver : public NotificationObserver { | 37 class BrowserActivityObserver : public NotificationObserver { |
| 37 public: | 38 public: |
| 38 BrowserActivityObserver() { | 39 BrowserActivityObserver() { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 << "observer list modified during notification"; | 183 << "observer list modified during notification"; |
| 183 } | 184 } |
| 184 | 185 |
| 185 | 186 |
| 186 // static | 187 // static |
| 187 void BrowserList::NotifyAndTerminate() { | 188 void BrowserList::NotifyAndTerminate() { |
| 188 NotificationService::current()->Notify(NotificationType::APP_TERMINATING, | 189 NotificationService::current()->Notify(NotificationType::APP_TERMINATING, |
| 189 NotificationService::AllSources(), | 190 NotificationService::AllSources(), |
| 190 NotificationService::NoDetails()); | 191 NotificationService::NoDetails()); |
| 191 #if defined(OS_CHROMEOS) | 192 #if defined(OS_CHROMEOS) |
| 193 chromeos::WmIpc::instance()->NotifyAboutSignout(); |
| 192 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) { | 194 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) { |
| 193 chromeos::CrosLibrary::Get()->GetLoginLibrary()->StopSession(""); | 195 chromeos::CrosLibrary::Get()->GetLoginLibrary()->StopSession(""); |
| 194 return; | 196 return; |
| 195 } | 197 } |
| 196 // If running the Chrome OS build, but we're not on the device, fall through | 198 // If running the Chrome OS build, but we're not on the device, fall through |
| 197 #endif | 199 #endif |
| 198 AllBrowsersClosedAndAppExiting(); | 200 AllBrowsersClosedAndAppExiting(); |
| 199 } | 201 } |
| 200 | 202 |
| 201 // static | 203 // static |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 } | 593 } |
| 592 | 594 |
| 593 TabContents* next_tab = | 595 TabContents* next_tab = |
| 594 (*browser_iterator_)->GetTabContentsAt(web_view_index_); | 596 (*browser_iterator_)->GetTabContentsAt(web_view_index_); |
| 595 if (next_tab) { | 597 if (next_tab) { |
| 596 cur_ = next_tab; | 598 cur_ = next_tab; |
| 597 return; | 599 return; |
| 598 } | 600 } |
| 599 } | 601 } |
| 600 } | 602 } |
| OLD | NEW |