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

Side by Side Diff: content/browser/accessibility/accessibility_ui.cc

Issue 16431010: Refactor RenderProcessHost to use IPC::Listener instead of RenderWidgetHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing Windows compile error. Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/accessibility/accessibility_ui.h" 5 #include "content/browser/accessibility/accessibility_ui.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 favicon_url, 87 favicon_url,
88 rvh->GetProcess()->GetID(), 88 rvh->GetProcess()->GetID(),
89 rvh->GetRoutingID(), 89 rvh->GetRoutingID(),
90 accessibility_mode); 90 accessibility_mode);
91 } 91 }
92 92
93 void SendTargetsData( 93 void SendTargetsData(
94 const WebUIDataSource::GotDataCallback& callback) { 94 const WebUIDataSource::GotDataCallback& callback) {
95 scoped_ptr<ListValue> rvh_list(new ListValue()); 95 scoped_ptr<ListValue> rvh_list(new ListValue());
96 96
97 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); 97 RenderWidgetHost::List widgets = RenderWidgetHost::GetRenderWidgetHosts();
98 !it.IsAtEnd(); it.Advance()) { 98 for (RenderWidgetHost::List::const_iterator it = widgets.begin();
99 RenderProcessHost* render_process_host = it.GetCurrentValue(); 99 it != widgets.end(); ++it) {
jam 2013/06/12 19:59:59 ditto
nasko 2013/06/12 21:18:59 Done.
100 DCHECK(render_process_host); 100 const RenderWidgetHost* widget = *it;
101
102 // Ignore processes that don't have a connection, such as crashed tabs. 101 // Ignore processes that don't have a connection, such as crashed tabs.
103 if (!render_process_host->HasConnection()) 102 if (!widget->GetProcess()->HasConnection())
104 continue; 103 continue;
105 104
106 RenderProcessHost::RenderWidgetHostsIterator rwh_it( 105 if (!widget->IsRenderView())
107 render_process_host->GetRenderWidgetHostsIterator());
108 for (; !rwh_it.IsAtEnd(); rwh_it.Advance()) {
109 const RenderWidgetHost* rwh = rwh_it.GetCurrentValue();
110 DCHECK(rwh);
111 if (!rwh || !rwh->IsRenderView())
112 continue; 106 continue;
113 107
114 RenderViewHost* rvh = 108 RenderViewHost* rvh =
115 RenderViewHost::From(const_cast<RenderWidgetHost*>(rwh)); 109 RenderViewHost::From(const_cast<RenderWidgetHost*>(widget));
116 110
117 rvh_list->Append(BuildTargetDescriptor(rvh)); 111 rvh_list->Append(BuildTargetDescriptor(rvh));
118 }
119 } 112 }
120 113
121 scoped_ptr<DictionaryValue> data(new DictionaryValue()); 114 scoped_ptr<DictionaryValue> data(new DictionaryValue());
122 data->Set("list", rvh_list.release()); 115 data->Set("list", rvh_list.release());
123 scoped_ptr<FundamentalValue> a11y_mode(new FundamentalValue( 116 scoped_ptr<FundamentalValue> a11y_mode(new FundamentalValue(
124 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode())); 117 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()));
125 data->Set("global_a11y_mode", a11y_mode.release()); 118 data->Set("global_a11y_mode", a11y_mode.release());
126 119
127 std::string json_string; 120 std::string json_string;
128 base::JSONWriter::Write(data.get(), &json_string); 121 base::JSONWriter::Write(data.get(), &json_string);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 AccessibilityTreeFormatter::Filter::ALLOW)); 250 AccessibilityTreeFormatter::Filter::ALLOW));
258 formatter->SetFilters(filters); 251 formatter->SetFilters(filters);
259 formatter->FormatAccessibilityTree(&accessibility_contents_utf16); 252 formatter->FormatAccessibilityTree(&accessibility_contents_utf16);
260 253
261 result->Set("tree", 254 result->Set("tree",
262 new StringValue(UTF16ToUTF8(accessibility_contents_utf16))); 255 new StringValue(UTF16ToUTF8(accessibility_contents_utf16)));
263 web_ui()->CallJavascriptFunction("accessibility.showTree", *(result.get())); 256 web_ui()->CallJavascriptFunction("accessibility.showTree", *(result.get()));
264 } 257 }
265 258
266 } // namespace content 259 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698