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

Unified Diff: content/browser/web_contents/web_contents_impl.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 24be3e297f298557beb17143989203ed9827b985..097b5149138c1008db14bb0cc289811cfca6f2ba 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -206,9 +206,8 @@ bool HasMatchingWidgetHost(FrameTree* tree, RenderWidgetHost* host) {
return false;
}
-void SetAccessibilityModeOnFrame(AccessibilityMode mode,
- RenderFrameHost* frame_host) {
- static_cast<RenderFrameHostImpl*>(frame_host)->SetAccessibilityMode(mode);
+void UpdateAccessibilityModeOnFrame(RenderFrameHost* frame_host) {
+ static_cast<RenderFrameHostImpl*>(frame_host)->UpdateAccessibilityMode();
}
void ResetAccessibility(RenderFrameHost* rfh) {
@@ -947,14 +946,19 @@ void WebContentsImpl::SetAccessibilityMode(AccessibilityMode mode) {
if (mode == accessibility_mode_)
return;
+ // Don't allow accessibility to be enabled for WebContents that are never
+ // visible, like background pages.
+ if (IsNeverVisible())
+ return;
+
accessibility_mode_ = mode;
for (FrameTreeNode* node : frame_tree_.Nodes()) {
- SetAccessibilityModeOnFrame(mode, node->current_frame_host());
+ UpdateAccessibilityModeOnFrame(node->current_frame_host());
RenderFrameHost* pending_frame_host =
node->render_manager()->pending_frame_host();
if (pending_frame_host)
- SetAccessibilityModeOnFrame(mode, pending_frame_host);
+ UpdateAccessibilityModeOnFrame(pending_frame_host);
}
}
@@ -4065,7 +4069,7 @@ const GURL& WebContentsImpl::GetMainFrameLastCommittedURL() const {
void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) {
for (auto& observer : observers_)
observer.RenderFrameCreated(render_frame_host);
- SetAccessibilityModeOnFrame(accessibility_mode_, render_frame_host);
+ UpdateAccessibilityModeOnFrame(render_frame_host);
if (!render_frame_host->IsRenderFrameLive() || render_frame_host->GetParent())
return;
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698