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