Index: apps/app_window_registry.cc |
diff --git a/apps/app_window_registry.cc b/apps/app_window_registry.cc |
index 62ba2e1df00a7c56ba6e32236c9217e4e86b7d2a..4ed0b8bbd9a6258c45f216cb10f8f88f034bc595 100644 |
--- a/apps/app_window_registry.cc |
+++ b/apps/app_window_registry.cc |
@@ -242,6 +242,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) { |