| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "content/browser/accessibility/accessibility_tree_formatter.h" | 15 #include "content/browser/accessibility/accessibility_tree_formatter.h" |
| 16 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" | 16 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" |
| 17 #include "content/browser/accessibility/browser_accessibility_manager.h" | 17 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 18 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 18 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 19 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 19 #include "content/browser/renderer_host/render_widget_host_impl.h" | 20 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 20 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 21 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 21 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
| 22 #include "content/browser/webui/web_ui_data_source_impl.h" | 23 #include "content/browser/webui/web_ui_data_source_impl.h" |
| 23 #include "content/common/view_message_enums.h" | 24 #include "content/common/view_message_enums.h" |
| 24 #include "content/grit/content_resources.h" | 25 #include "content/grit/content_resources.h" |
| 25 #include "content/public/browser/favicon_status.h" | 26 #include "content/public/browser/favicon_status.h" |
| 26 #include "content/public/browser/navigation_entry.h" | 27 #include "content/public/browser/navigation_entry.h" |
| 27 #include "content/public/browser/render_process_host.h" | 28 #include "content/public/browser/render_process_host.h" |
| 28 #include "content/public/browser/render_view_host.h" | 29 #include "content/public/browser/render_view_host.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 std::unique_ptr<RenderWidgetHostIterator> widgets( | 110 std::unique_ptr<RenderWidgetHostIterator> widgets( |
| 110 RenderWidgetHost::GetRenderWidgetHosts()); | 111 RenderWidgetHost::GetRenderWidgetHosts()); |
| 111 | 112 |
| 112 while (RenderWidgetHost* widget = widgets->GetNextHost()) { | 113 while (RenderWidgetHost* widget = widgets->GetNextHost()) { |
| 113 // Ignore processes that don't have a connection, such as crashed tabs. | 114 // Ignore processes that don't have a connection, such as crashed tabs. |
| 114 if (!widget->GetProcess()->HasConnection()) | 115 if (!widget->GetProcess()->HasConnection()) |
| 115 continue; | 116 continue; |
| 116 RenderViewHost* rvh = RenderViewHost::From(widget); | 117 RenderViewHost* rvh = RenderViewHost::From(widget); |
| 117 if (!rvh) | 118 if (!rvh) |
| 118 continue; | 119 continue; |
| 120 // Ignore views that are never visible, like background pages. |
| 121 if (static_cast<RenderViewHostImpl*>(rvh)->GetDelegate()->IsNeverVisible()) |
| 122 continue; |
| 119 BrowserContext* context = rvh->GetProcess()->GetBrowserContext(); | 123 BrowserContext* context = rvh->GetProcess()->GetBrowserContext(); |
| 120 if (context != current_context) | 124 if (context != current_context) |
| 121 continue; | 125 continue; |
| 122 | 126 |
| 123 rvh_list->Append(BuildTargetDescriptor(rvh)); | 127 rvh_list->Append(BuildTargetDescriptor(rvh)); |
| 124 } | 128 } |
| 125 | 129 |
| 126 base::DictionaryValue data; | 130 base::DictionaryValue data; |
| 127 data.Set("list", rvh_list.release()); | 131 data.Set("list", rvh_list.release()); |
| 128 data.SetInteger( | 132 data.SetInteger( |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(), | 264 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(), |
| 261 &accessibility_contents_utf16); | 265 &accessibility_contents_utf16); |
| 262 result->Set("tree", | 266 result->Set("tree", |
| 263 new base::StringValue( | 267 new base::StringValue( |
| 264 base::UTF16ToUTF8(accessibility_contents_utf16))); | 268 base::UTF16ToUTF8(accessibility_contents_utf16))); |
| 265 web_ui()->CallJavascriptFunctionUnsafe("accessibility.showTree", | 269 web_ui()->CallJavascriptFunctionUnsafe("accessibility.showTree", |
| 266 *(result.get())); | 270 *(result.get())); |
| 267 } | 271 } |
| 268 | 272 |
| 269 } // namespace content | 273 } // namespace content |
| OLD | NEW |