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) { |