Index: chrome/browser/ui/browser.cc |
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
index 3cc7dac61f7490c3e6855e7bbf1bdc56e2d6e774..0d27f653c30dc2977189578d155b3eb385d552bc 100644 |
--- a/chrome/browser/ui/browser.cc |
+++ b/chrome/browser/ui/browser.cc |
@@ -220,6 +220,7 @@ |
#if defined(USE_ASH) |
#include "ash/ash_switches.h" |
+#include "ash/shell.h" |
#endif |
using base::TimeDelta; |
@@ -714,7 +715,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()) { |
#if defined(OS_WIN) |
browser_watcher::ExitFunnel::RecordSingleEvent( |
chrome::kBrowserExitCodesRegistryPath, L"LastWindowClose"); |
@@ -2607,6 +2608,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(); |
+ else if (host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
sky
2015/10/07 17:12:32
nit: no else.
Lei Zhang
2015/10/08 07:01:58
copy + paste
|
+ return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); |
+#endif |
+ return true; |
+} |
+ |
bool Browser::MaybeCreateBackgroundContents( |
int route_id, |
int main_frame_route_id, |