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

Unified Diff: chrome/browser/ui/browser.cc

Issue 1388303002: Move assorted function in application_lifetime to where they are used. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 2 months 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 | « chrome/browser/ui/browser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698