OLD | NEW |
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 return false; | 98 return false; |
99 scoped_ptr<base::ListValue> rvh_list(new base::ListValue()); | 99 scoped_ptr<base::ListValue> rvh_list(new base::ListValue()); |
100 | 100 |
101 scoped_ptr<RenderWidgetHostIterator> widgets( | 101 scoped_ptr<RenderWidgetHostIterator> widgets( |
102 RenderWidgetHost::GetRenderWidgetHosts()); | 102 RenderWidgetHost::GetRenderWidgetHosts()); |
103 | 103 |
104 while (RenderWidgetHost* widget = widgets->GetNextHost()) { | 104 while (RenderWidgetHost* widget = widgets->GetNextHost()) { |
105 // Ignore processes that don't have a connection, such as crashed tabs. | 105 // Ignore processes that don't have a connection, such as crashed tabs. |
106 if (!widget->GetProcess()->HasConnection()) | 106 if (!widget->GetProcess()->HasConnection()) |
107 continue; | 107 continue; |
108 if (!widget->IsRenderView()) | 108 RenderViewHost* rvh = RenderViewHost::From(widget); |
109 continue; | 109 if (!rvh) |
110 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 110 continue; |
111 BrowserContext* context = rwhi->GetProcess()->GetBrowserContext(); | 111 BrowserContext* context = rvh->GetProcess()->GetBrowserContext(); |
112 if (context != current_context) | 112 if (context != current_context) |
113 continue; | 113 continue; |
114 | 114 |
115 RenderViewHost* rvh = RenderViewHost::From(widget); | |
116 rvh_list->Append(BuildTargetDescriptor(rvh)); | 115 rvh_list->Append(BuildTargetDescriptor(rvh)); |
117 } | 116 } |
118 | 117 |
119 base::DictionaryValue data; | 118 base::DictionaryValue data; |
120 data.Set("list", rvh_list.release()); | 119 data.Set("list", rvh_list.release()); |
121 data.SetInteger( | 120 data.SetInteger( |
122 "global_a11y_mode", | 121 "global_a11y_mode", |
123 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()); | 122 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()); |
124 | 123 |
125 std::string json_string; | 124 std::string json_string; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 formatter->SetFilters(filters); | 232 formatter->SetFilters(filters); |
234 formatter->FormatAccessibilityTree(&accessibility_contents_utf16); | 233 formatter->FormatAccessibilityTree(&accessibility_contents_utf16); |
235 | 234 |
236 result->Set("tree", | 235 result->Set("tree", |
237 new base::StringValue( | 236 new base::StringValue( |
238 base::UTF16ToUTF8(accessibility_contents_utf16))); | 237 base::UTF16ToUTF8(accessibility_contents_utf16))); |
239 web_ui()->CallJavascriptFunction("accessibility.showTree", *(result.get())); | 238 web_ui()->CallJavascriptFunction("accessibility.showTree", *(result.get())); |
240 } | 239 } |
241 | 240 |
242 } // namespace content | 241 } // namespace content |
OLD | NEW |