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

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

Issue 2544993002: Avoid enabling accessibility for WebContents that are never shown (Closed)
Patch Set: Get rid of 'extension' from content code Created 4 years 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
« no previous file with comments | « no previous file | content/browser/frame_host/interstitial_page_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <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
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
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
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/interstitial_page_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698