summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_list.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-19 02:27:16 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-19 02:27:16 +0000
commit299dabdd2178ac3126282ac854da86b6cd84be02 (patch)
tree4626d596651704ec7b467d60c011da7efe18dcda /chrome/browser/browser_list.cc
parent2758136c0f073eacbb2943d5029b90eb4b1e5512 (diff)
downloadchromium_src-299dabdd2178ac3126282ac854da86b6cd84be02.zip
chromium_src-299dabdd2178ac3126282ac854da86b6cd84be02.tar.gz
chromium_src-299dabdd2178ac3126282ac854da86b6cd84be02.tar.bz2
Land this change again now I've fixed the crash.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5669 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_list.cc')
-rw-r--r--chrome/browser/browser_list.cc36
1 files changed, 34 insertions, 2 deletions
diff --git a/chrome/browser/browser_list.cc b/chrome/browser/browser_list.cc
index 9e0b2e4..67d6a56 100644
--- a/chrome/browser/browser_list.cc
+++ b/chrome/browser/browser_list.cc
@@ -6,7 +6,9 @@
#include "base/logging.h"
#include "base/message_loop.h"
+#include "chrome/app/result_codes.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/profile_manager.h"
@@ -134,6 +136,36 @@ void BrowserList::CloseAllBrowsers(bool use_post) {
}
// static
+void BrowserList::WindowsSessionEnding() {
+ // EndSession is invoked once per frame. Only do something the first time.
+ static bool already_ended = false;
+ if (already_ended)
+ return;
+ already_ended = true;
+
+ browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION);
+
+ // Write important data first.
+ g_browser_process->EndSession();
+
+ // Close all the browsers.
+ BrowserList::CloseAllBrowsers(false);
+
+ // Send out notification. This is used during testing so that the test harness
+ // can properly shutdown before we exit.
+ NotificationService::current()->Notify(NOTIFY_SESSION_END,
+ NotificationService::AllSources(),
+ NotificationService::NoDetails());
+
+ // And shutdown.
+ browser_shutdown::Shutdown();
+
+ // At this point the message loop is still running yet we've shut everything
+ // down. If any messages are processed we'll likely crash. Exit now.
+ ExitProcess(ResultCodes::NORMAL_EXIT);
+}
+
+// static
bool BrowserList::HasBrowserWithProfile(Profile* profile) {
BrowserList::const_iterator iter;
for (size_t i = 0; i < browsers_.size(); ++i) {
@@ -176,7 +208,7 @@ Browser* BrowserList::GetLastActive() {
}
// static
-Browser* BrowserList::FindBrowserWithType(Profile* p, BrowserType::Type t) {
+Browser* BrowserList::FindBrowserWithType(Profile* p, Browser::Type t) {
Browser* last_active = GetLastActive();
if (last_active && last_active->profile() == p && last_active->type() == t)
return last_active;
@@ -193,7 +225,7 @@ Browser* BrowserList::FindBrowserWithType(Profile* p, BrowserType::Type t) {
}
// static
-size_t BrowserList::GetBrowserCountForType(Profile* p, BrowserType::Type type) {
+size_t BrowserList::GetBrowserCountForType(Profile* p, Browser::Type type) {
BrowserList::const_iterator i;
size_t result = 0;
for (i = BrowserList::begin(); i != BrowserList::end(); ++i) {