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

Unified Diff: chrome/browser/metro_viewer/metro_viewer_process_host_win.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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metro_viewer/metro_viewer_process_host_win.cc
===================================================================
--- chrome/browser/metro_viewer/metro_viewer_process_host_win.cc (revision 170107)
+++ chrome/browser/metro_viewer/metro_viewer_process_host_win.cc (working copy)
@@ -6,14 +6,40 @@
#include "base/logging.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/ui/ash/ash_init.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_list_impl.h"
+#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/host_desktop.h"
+#include "chrome/browser/ui/tab_contents/tab_contents.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "content/public/browser/browser_thread.h"
#include "ipc/ipc_channel_proxy.h"
#include "ui/aura/remote_root_window_host_win.h"
#include "ui/metro_viewer/metro_viewer_messages.h"
#include "ui/surface/accelerated_surface_win.h"
+namespace {
+
+void CloseOpenAshBrowsers() {
+ chrome::BrowserListImpl* browser_list =
+ chrome::BrowserListImpl::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH);
+ 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);
+ }
+ }
+}
+
+} // namespace
+
+
MetroViewerProcessHost::MetroViewerProcessHost(
const std::string& ipc_channel_name) {
g_browser_process->AddRefModule();
@@ -54,6 +80,7 @@
// is very convenient for developing.
DLOG(INFO) << "viewer channel error : Quitting browser";
g_browser_process->ReleaseModule();
+ CloseOpenAshBrowsers();
chrome::CloseAsh();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698