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

Unified Diff: chrome/browser/extensions/extensions_ui.cc

Issue 126137: Part 1 of merging Extensions and DOMUI (Closed)
Patch Set: add test and rebase Created 11 years, 6 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 | « chrome/browser/extensions/extension_startup_unittest.cc ('k') | chrome/browser/external_tab_container.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extensions_ui.cc
diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc
index 7ad40cc3fa9a35c51561d28b9411d5e44629118a..62fb5599b33684bc11ed405f8e8986e2122e46f1 100644
--- a/chrome/browser/extensions/extensions_ui.cc
+++ b/chrome/browser/extensions/extensions_ui.cc
@@ -226,29 +226,16 @@ DictionaryValue* ExtensionsDOMHandler::CreateExtensionDetailValue(
std::vector<ExtensionPage> ExtensionsDOMHandler::GetActivePagesForExtension(
const std::string& extension_id) {
std::vector<ExtensionPage> result;
-
- ExtensionMessageService* ems = ExtensionMessageService::GetInstance(
- dom_ui_->GetProfile()->GetOriginalProfile()->GetRequestContext());
- RenderProcessHost* process_host = ems->GetProcessForExtension(extension_id);
- if (!process_host)
- return result;
-
- RenderProcessHost::listeners_iterator iter;
- for (iter = process_host->listeners_begin();
- iter != process_host->listeners_end(); ++iter) {
- // NOTE: This is a bit dangerous. We know that for now, listeners are
- // always RenderWidgetHosts. But in theory, they don't have to be.
- RenderWidgetHost* widget = static_cast<RenderWidgetHost*>(iter->second);
- if (!widget->IsRenderView())
- continue;
-
- RenderViewHost* view = static_cast<RenderViewHost*>(widget);
- ExtensionFunctionDispatcher* efd = view->extension_function_dispatcher();
- if (efd && efd->extension_id() == extension_id) {
- ExtensionPage page(view->delegate()->GetURL(),
- process_host->pid(),
- view->routing_id());
- result.push_back(page);
+ std::set<ExtensionFunctionDispatcher*>* all_instances =
+ ExtensionFunctionDispatcher::all_instances();
+
+ for (std::set<ExtensionFunctionDispatcher*>::iterator iter =
+ all_instances->begin(); iter != all_instances->end(); ++iter) {
+ RenderViewHost* view = (*iter)->render_view_host();
+ if ((*iter)->extension_id() == extension_id && view) {
+ result.push_back(ExtensionPage((*iter)->url(),
+ view->process()->pid(),
+ view->routing_id()));
}
}
« no previous file with comments | « chrome/browser/extensions/extension_startup_unittest.cc ('k') | chrome/browser/external_tab_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698