Index: chrome/browser/ui/browser.cc |
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
index 24e66d5bc5b64fc37c86952cf422503a53cf3898..584a1d6c89b4a268ea59fa003de885d92df9b9f6 100644 |
--- a/chrome/browser/ui/browser.cc |
+++ b/chrome/browser/ui/browser.cc |
@@ -219,6 +219,7 @@ |
#if defined(USE_ASH) |
#include "ash/ash_switches.h" |
+#include "ash/shell.h" |
#endif |
using base::TimeDelta; |
@@ -713,7 +714,7 @@ void Browser::OnWindowClosing() { |
bool should_quit_if_last_browser = |
browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive(); |
- if (should_quit_if_last_browser && chrome::ShouldStartShutdown(this)) |
+ if (should_quit_if_last_browser && ShouldStartShutdown()) |
browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); |
// Don't use GetForProfileIfExisting here, we want to force creation of the |
@@ -2601,6 +2602,25 @@ bool Browser::ShouldHideUIForFullscreen() const { |
return window_ && window_->ShouldHideUIForFullscreen(); |
} |
+bool Browser::ShouldStartShutdown() const { |
+ if (BrowserList::GetInstance(host_desktop_type())->size() > 1) |
+ return false; |
+#if defined(OS_WIN) |
+ // On Windows 8 the desktop and ASH environments could be active |
+ // at the same time. |
+ // We should not start the shutdown process in the following cases:- |
+ // 1. If the desktop type of the browser going away is ASH and there |
+ // are browser windows open in the desktop. |
+ // 2. If the desktop type of the browser going away is desktop and the ASH |
+ // environment is still active. |
+ if (host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) |
+ return !ash::Shell::HasInstance(); |
+ if (host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
+ return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); |
+#endif |
+ return true; |
+} |
+ |
bool Browser::MaybeCreateBackgroundContents( |
int route_id, |
int main_frame_route_id, |