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

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: Rebase on top of hash_pair move. 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 favicon_url, 84 favicon_url,
85 rvh->GetProcess()->GetID(), 85 rvh->GetProcess()->GetID(),
86 rvh->GetRoutingID(), 86 rvh->GetRoutingID(),
87 accessibility_mode); 87 accessibility_mode);
88 } 88 }
89 89
90 void SendTargetsData( 90 void SendTargetsData(
91 const WebUIDataSource::GotDataCallback& callback) { 91 const WebUIDataSource::GotDataCallback& callback) {
92 scoped_ptr<base::ListValue> rvh_list(new base::ListValue()); 92 scoped_ptr<base::ListValue> rvh_list(new base::ListValue());
93 93
94 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); 94 RenderWidgetHost::List widgets = RenderWidgetHost::GetRenderWidgetHosts();
95 !it.IsAtEnd(); it.Advance()) { 95 for (size_t i = 0; i < widgets.size(); ++i) {
96 RenderProcessHost* render_process_host = it.GetCurrentValue();
97 DCHECK(render_process_host);
98
99 // Ignore processes that don't have a connection, such as crashed tabs. 96 // Ignore processes that don't have a connection, such as crashed tabs.
100 if (!render_process_host->HasConnection()) 97 if (!widgets[i]->GetProcess()->HasConnection())
101 continue; 98 continue;
102 99 if (!widgets[i]->IsRenderView())
103 RenderProcessHost::RenderWidgetHostsIterator rwh_it(
104 render_process_host->GetRenderWidgetHostsIterator());
105 for (; !rwh_it.IsAtEnd(); rwh_it.Advance()) {
106 const RenderWidgetHost* rwh = rwh_it.GetCurrentValue();
107 DCHECK(rwh);
108 if (!rwh || !rwh->IsRenderView())
109 continue; 100 continue;
110 101
111 RenderViewHost* rvh = 102 RenderViewHost* rvh = RenderViewHost::From(widgets[i]);
112 RenderViewHost::From(const_cast<RenderWidgetHost*>(rwh)); 103 rvh_list->Append(BuildTargetDescriptor(rvh));
113
114 rvh_list->Append(BuildTargetDescriptor(rvh));
115 }
116 } 104 }
117 105
118 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); 106 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
119 data->Set("list", rvh_list.release()); 107 data->Set("list", rvh_list.release());
120 scoped_ptr<base::FundamentalValue> a11y_mode(new base::FundamentalValue( 108 scoped_ptr<base::FundamentalValue> a11y_mode(new base::FundamentalValue(
121 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode())); 109 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()));
122 data->Set("global_a11y_mode", a11y_mode.release()); 110 data->Set("global_a11y_mode", a11y_mode.release());
123 111
124 std::string json_string; 112 std::string json_string;
125 base::JSONWriter::Write(data.get(), &json_string); 113 base::JSONWriter::Write(data.get(), &json_string);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 AccessibilityTreeFormatter::Filter::ALLOW)); 244 AccessibilityTreeFormatter::Filter::ALLOW));
257 formatter->SetFilters(filters); 245 formatter->SetFilters(filters);
258 formatter->FormatAccessibilityTree(&accessibility_contents_utf16); 246 formatter->FormatAccessibilityTree(&accessibility_contents_utf16);
259 247
260 result->Set("tree", 248 result->Set("tree",
261 new base::StringValue(UTF16ToUTF8(accessibility_contents_utf16))); 249 new base::StringValue(UTF16ToUTF8(accessibility_contents_utf16)));
262 web_ui()->CallJavascriptFunction("accessibility.showTree", *(result.get())); 250 web_ui()->CallJavascriptFunction("accessibility.showTree", *(result.get()));
263 } 251 }
264 252
265 } // namespace content 253 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/validation_message_message_filter.cc ('k') | content/browser/accessibility/browser_accessibility_state_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698