From 039b84a4289dc5e816ed645c127129a97c060c9a Mon Sep 17 00:00:00 2001
From: "nasko@chromium.org"
 <nasko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Fri, 21 Jun 2013 20:23:37 +0000
Subject: Refactor RenderProcessHost to use IPC::Listener instead of
 RenderWidgetHost

BUG=248160

Review URL: https://chromiumcodereview.appspot.com/16431010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207913 0039d316-1c4b-4281-b951-d872f2087c98
---
 .../browser_accessibility_state_impl.cc            | 23 ++++++----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

(limited to 'content/browser/accessibility/browser_accessibility_state_impl.cc')

diff --git a/content/browser/accessibility/browser_accessibility_state_impl.cc b/content/browser/accessibility/browser_accessibility_state_impl.cc
index 92bc94e..d2f081a 100644
--- a/content/browser/accessibility/browser_accessibility_state_impl.cc
+++ b/content/browser/accessibility/browser_accessibility_state_impl.cc
@@ -128,27 +128,16 @@ void BrowserAccessibilityStateImpl::SetAccessibilityMode(
   if (accessibility_mode_ == mode)
     return;
   accessibility_mode_ = mode;
-  for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator());
-       !it.IsAtEnd(); it.Advance()) {
-    RenderProcessHost* render_process_host = it.GetCurrentValue();
-    DCHECK(render_process_host);
 
+  RenderWidgetHost::List widgets = RenderWidgetHost::GetRenderWidgetHosts();
+  for (size_t i = 0; i < widgets.size(); ++i) {
     // Ignore processes that don't have a connection, such as crashed tabs.
-    if (!render_process_host->HasConnection())
+    if (!widgets[i]->GetProcess()->HasConnection())
+      continue;
+    if (!widgets[i]->IsRenderView())
       continue;
 
-    for (RenderProcessHost::RenderWidgetHostsIterator rwit(
-             render_process_host->GetRenderWidgetHostsIterator());
-         !rwit.IsAtEnd();
-         rwit.Advance()) {
-      RenderWidgetHost* rwh = const_cast<RenderWidgetHost*>(
-          rwit.GetCurrentValue());
-      DCHECK(rwh);
-      if (!rwh || !rwh->IsRenderView())
-        continue;
-      RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh);
-      rwhi->SetAccessibilityMode(mode);
-    }
+    RenderWidgetHostImpl::From(widgets[i])->SetAccessibilityMode(mode);
   }
 }
 
-- 
cgit v1.1