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

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
« no previous file with comments | « apps/app_window_registry.h ('k') | chrome/app/chromium_strings.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/app_window_registry.cc
diff --git a/apps/app_window_registry.cc b/apps/app_window_registry.cc
index 82d8293f08c6c4a492f0f5e62f4a7dfb64423e60..8592e7423878ba9ad08597003174984bb55e930a 100644
--- a/apps/app_window_registry.cc
+++ b/apps/app_window_registry.cc
@@ -228,6 +228,25 @@ 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;
+
+ const AppWindowList& app_windows = registry->app_windows();
+ while (!app_windows.empty())
tapted 2014/04/03 03:49:15 nit: I would just use !registry->app_windows_.empt
jackhou1 2014/04/03 04:00:52 Done.
+ app_windows.front()->GetBaseWindow()->Close();
+ }
+}
+
void AppWindowRegistry::OnDevToolsStateChanged(
content::DevToolsAgentHost* agent_host,
bool attached) {
« no previous file with comments | « apps/app_window_registry.h ('k') | chrome/app/chromium_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698