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

Unified Diff: chrome/browser/automation/automation_util.cc

Issue 10113005: Remove EPM:all_hosts_ and use all_extension_views_ instead. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: interactive_ui_tests Created 8 years, 8 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
Index: chrome/browser/automation/automation_util.cc
diff --git a/chrome/browser/automation/automation_util.cc b/chrome/browser/automation/automation_util.cc
index 9ab71f243463add2e0c290527112610c6ed37604..cbe7ce8e382cafc040dbe87cd83ed4bfa85283fc 100644
--- a/chrome/browser/automation/automation_util.cc
+++ b/chrome/browser/automation/automation_util.cc
@@ -15,7 +15,6 @@
#include "base/values.h"
#include "chrome/browser/automation/automation_provider.h"
#include "chrome/browser/automation/automation_provider_json.h"
-#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/printing/print_preview_tab_controller.h"
@@ -32,6 +31,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/render_view_host_delegate.h"
#include "content/public/browser/web_contents.h"
#include "net/cookies/cookie_monster.h"
#include "net/cookies/cookie_store.h"
@@ -413,9 +413,10 @@ AutomationId GetIdForTab(const TabContentsWrapper* tab) {
base::IntToString(tab->restore_tab_helper()->session_id().id()));
}
-AutomationId GetIdForExtensionView(const ExtensionHost* ext_host) {
+AutomationId GetIdForExtensionView(
+ const content::RenderViewHost* render_view_host) {
AutomationId::Type type;
- switch (ext_host->extension_host_type()) {
+ switch (render_view_host->GetDelegate()->GetRenderViewType()) {
case chrome::VIEW_TYPE_EXTENSION_POPUP:
type = AutomationId::kTypeExtensionPopup;
break;
@@ -432,8 +433,8 @@ AutomationId GetIdForExtensionView(const ExtensionHost* ext_host) {
// Since these extension views do not permit navigation, using the
// renderer process and view ID should suffice.
std::string id = base::StringPrintf("%d|%d",
- ext_host->render_view_host()->GetRoutingID(),
- ext_host->render_process_host()->GetID());
+ render_view_host->GetRoutingID(),
+ render_view_host->GetProcess()->GetID());
return AutomationId(type, id);
}
@@ -482,13 +483,16 @@ bool GetExtensionRenderViewForId(
RenderViewHost** rvh) {
ExtensionProcessManager* extension_mgr =
profile->GetExtensionProcessManager();
- ExtensionProcessManager::const_iterator iter;
- for (iter = extension_mgr->begin(); iter != extension_mgr->end();
+ const ExtensionProcessManager::ContentsSet contents_set =
+ extension_mgr->GetAllContents();
+ for (ExtensionProcessManager::ContentsSet::const_iterator iter =
+ contents_set.begin(); iter != contents_set.end();
++iter) {
- ExtensionHost* host = *iter;
+ content::WebContents* contents = *iter;
+ RenderViewHost* host = contents->GetRenderViewHost();
Charlie Reis 2012/04/19 21:42:10 We need to be very careful here. GetRenderViewHos
Aaron Boodman 2012/04/20 01:00:55 Good point. My bad, I forgot that WebContents enca
AutomationId this_id = GetIdForExtensionView(host);
if (id == this_id) {
- *rvh = host->render_view_host();
+ *rvh = host;
return true;
}
}

Powered by Google App Engine
This is Rietveld 408576698