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

Unified Diff: apps/app_window_registry.cc

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: apps/app_window_registry.cc
diff --git a/apps/app_window_registry.cc b/apps/app_window_registry.cc
index 82d8293f08c6c4a492f0f5e62f4a7dfb64423e60..741cdc685e17989d5c594a38d57ef6a0f253b43d 100644
--- a/apps/app_window_registry.cc
+++ b/apps/app_window_registry.cc
@@ -228,6 +228,24 @@ bool AppWindowRegistry::IsAppWindowRegisteredInAnyProfile(
return false;
}
+// static
+void AppWindowRegistry::CloseAllAppWindows() {
+ std::vector<content::BrowserContext*> contexts =
+ AppsClient::Get()->GetLoadedBrowserContexts();
+ for (std::vector<content::BrowserContext*>::const_iterator i =
+ contexts.begin();
+ i != contexts.end();
+ ++i) {
+ AppWindowRegistry* registry =
+ Factory::GetForBrowserContext(*i, false /* create */);
+ if (!registry)
+ continue;
+
+ while (!registry->app_windows().empty())
+ registry->app_windows().front()->GetBaseWindow()->Close();
+ }
+}
+
void AppWindowRegistry::OnDevToolsStateChanged(
content::DevToolsAgentHost* agent_host,
bool attached) {

Powered by Google App Engine
This is Rietveld 408576698