Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1762)

Unified Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 11434013: In Chrome ASH on Windows 8 make sure that the browser object is closed before destroying it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/lifetime/application_lifetime.cc
===================================================================
--- chrome/browser/lifetime/application_lifetime.cc (revision 170107)
+++ chrome/browser/lifetime/application_lifetime.cc (working copy)
@@ -16,6 +16,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_list_impl.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
@@ -206,6 +207,22 @@
}
}
+void CloseAllBrowsersOfType(chrome::HostDesktopType type) {
sky 2012/11/29 20:28:03 I'm worried that keeping this here means other fol
ananta 2012/11/29 21:55:42 Done. Added a local function CloseOpenAshBrowsers
+ chrome::BrowserListImpl* browser_list =
+ chrome::BrowserListImpl::GetInstance(type);
+ if (browser_list) {
+ for (chrome::BrowserListImpl::const_iterator i = browser_list->begin();
+ i != browser_list->end(); ++i) {
+ Browser* browser = *i;
+ browser->window()->Close();
+ // If the attempt to Close the browser fails due to unload handlers on
+ // the page or in progress downloads, etc, destroy all tabs on the page.
+ while (browser->tab_count())
+ delete browser->tab_strip_model()->GetTabContentsAt(0);
+ }
+ }
+}
+
void AttemptUserExit() {
#if defined(OS_CHROMEOS)
chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false);
« no previous file with comments | « chrome/browser/lifetime/application_lifetime.h ('k') | chrome/browser/metro_viewer/metro_viewer_process_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698