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

Unified Diff: chrome/browser/app_controller_mac.mm

Issue 220373003: Prevent Chrome from quitting when apps are open. (Mac) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 9 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
Index: chrome/browser/app_controller_mac.mm
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 70b0707c5dea2c852de1dd84aee4dbdbcca41080..cca2cdf0dd07540ed2957acadf64d6a4e39ee286 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -52,6 +52,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
#import "chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.h"
+#include "chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
#import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
@@ -370,6 +371,12 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
![self shouldQuitWithInProgressDownloads])
return NO;
+ // Check for active apps, and prompt the user if they really want to quit
+ // (and also quit the apps).
+ if (!browser_shutdown::IsTryingToQuit() &&
+ quitWithAppsController_.get() && !quitWithAppsController_->ShouldQuit())
+ return NO;
+
// TODO(viettrungluu): Remove Apple Event handlers here? (It's safe to leave
// them in, but I'm not sure about UX; we'd also want to disable other things
// though.) http://crbug.com/40861
@@ -694,6 +701,10 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
// main menu item titles are not yet initialized in awakeFromNib.
[self initAppShimMenuController];
+ // If enabled, keep Chrome alive when apps are open instead of quitting all
+ // apps.
+ quitWithAppsController_ = new QuitWithAppsController();
+
// Build up the encoding menu, the order of the items differs based on the
// current locale (see http://crbug.com/7647 for details).
// We need a valid g_browser_process to get the profile which is why we can't

Powered by Google App Engine
This is Rietveld 408576698