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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1815933002: Fix WebView accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add browser test for focusing into a web view Created 4 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 rfh_state_(STATE_DEFAULT), 198 rfh_state_(STATE_DEFAULT),
199 render_frame_created_(false), 199 render_frame_created_(false),
200 navigations_suspended_(false), 200 navigations_suspended_(false),
201 is_waiting_for_beforeunload_ack_(false), 201 is_waiting_for_beforeunload_ack_(false),
202 unload_ack_is_for_navigation_(false), 202 unload_ack_is_for_navigation_(false),
203 is_loading_(false), 203 is_loading_(false),
204 pending_commit_(false), 204 pending_commit_(false),
205 nav_entry_id_(0), 205 nav_entry_id_(0),
206 accessibility_reset_token_(0), 206 accessibility_reset_token_(0),
207 accessibility_reset_count_(0), 207 accessibility_reset_count_(0),
208 browser_plugin_embedder_ax_tree_id_(AXTreeIDRegistry::kNoAXTreeID),
208 no_create_browser_accessibility_manager_for_testing_(false), 209 no_create_browser_accessibility_manager_for_testing_(false),
209 web_ui_type_(WebUI::kNoWebUI), 210 web_ui_type_(WebUI::kNoWebUI),
210 pending_web_ui_type_(WebUI::kNoWebUI), 211 pending_web_ui_type_(WebUI::kNoWebUI),
211 should_reuse_web_ui_(false), 212 should_reuse_web_ui_(false),
212 weak_ptr_factory_(this) { 213 weak_ptr_factory_(this) {
213 bool hidden = !!(flags & CREATE_RF_HIDDEN); 214 bool hidden = !!(flags & CREATE_RF_HIDDEN);
214 frame_tree_->AddRenderViewHostRef(render_view_host_); 215 frame_tree_->AddRenderViewHostRef(render_view_host_);
215 GetProcess()->AddRoute(routing_id_, this); 216 GetProcess()->AddRoute(routing_id_, this);
216 g_routing_id_frame_map.Get().insert(std::make_pair( 217 g_routing_id_frame_map.Get().insert(std::make_pair(
217 RenderFrameHostID(GetProcess()->GetID(), routing_id_), 218 RenderFrameHostID(GetProcess()->GetID(), routing_id_),
(...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2397 detail.update.has_tree_data = true; 2398 detail.update.has_tree_data = true;
2398 AXContentTreeDataToAXTreeData(&detail.update.tree_data); 2399 AXContentTreeDataToAXTreeData(&detail.update.tree_data);
2399 details.push_back(detail); 2400 details.push_back(detail);
2400 2401
2401 if (browser_accessibility_manager_) 2402 if (browser_accessibility_manager_)
2402 browser_accessibility_manager_->OnAccessibilityEvents(details); 2403 browser_accessibility_manager_->OnAccessibilityEvents(details);
2403 2404
2404 delegate_->AccessibilityEventReceived(details); 2405 delegate_->AccessibilityEventReceived(details);
2405 } 2406 }
2406 2407
2408 void RenderFrameHostImpl::SetBrowserPluginEmbedderAXTreeID(
2409 AXTreeIDRegistry::AXTreeID ax_tree_id) {
2410 browser_plugin_embedder_ax_tree_id_ = ax_tree_id;
2411 }
2412
2407 void RenderFrameHostImpl::SetTextTrackSettings( 2413 void RenderFrameHostImpl::SetTextTrackSettings(
2408 const FrameMsg_TextTrackSettings_Params& params) { 2414 const FrameMsg_TextTrackSettings_Params& params) {
2409 DCHECK(!GetParent()); 2415 DCHECK(!GetParent());
2410 Send(new FrameMsg_SetTextTrackSettings(routing_id_, params)); 2416 Send(new FrameMsg_SetTextTrackSettings(routing_id_, params));
2411 } 2417 }
2412 2418
2413 const ui::AXTree* RenderFrameHostImpl::GetAXTreeForTesting() { 2419 const ui::AXTree* RenderFrameHostImpl::GetAXTreeForTesting() {
2414 return ax_tree_for_testing_.get(); 2420 return ax_tree_for_testing_.get();
2415 } 2421 }
2416 2422
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2642 AccessibilityFatalError(); 2648 AccessibilityFatalError();
2643 return AXTreeIDRegistry::kNoAXTreeID; 2649 return AXTreeIDRegistry::kNoAXTreeID;
2644 } 2650 }
2645 2651
2646 return rfh->GetAXTreeID(); 2652 return rfh->GetAXTreeID();
2647 } 2653 }
2648 2654
2649 AXTreeIDRegistry::AXTreeID 2655 AXTreeIDRegistry::AXTreeID
2650 RenderFrameHostImpl::BrowserPluginInstanceIDToAXTreeID( 2656 RenderFrameHostImpl::BrowserPluginInstanceIDToAXTreeID(
2651 int instance_id) { 2657 int instance_id) {
2652 RenderFrameHost* guest = delegate()->GetGuestByInstanceID( 2658 RenderFrameHostImpl* guest = static_cast<RenderFrameHostImpl*>(
2653 this, instance_id); 2659 delegate()->GetGuestByInstanceID(this, instance_id));
2654 if (!guest) 2660 if (!guest)
2655 return AXTreeIDRegistry::kNoAXTreeID; 2661 return AXTreeIDRegistry::kNoAXTreeID;
2656 2662
2663 guest->SetBrowserPluginEmbedderAXTreeID(GetAXTreeID());
2664
2657 return guest->GetAXTreeID(); 2665 return guest->GetAXTreeID();
2658 } 2666 }
2659 2667
2660 void RenderFrameHostImpl::AXContentNodeDataToAXNodeData( 2668 void RenderFrameHostImpl::AXContentNodeDataToAXNodeData(
2661 const AXContentNodeData& src, 2669 const AXContentNodeData& src,
2662 ui::AXNodeData* dst) { 2670 ui::AXNodeData* dst) {
2663 // Copy the common fields. 2671 // Copy the common fields.
2664 *dst = src; 2672 *dst = src;
2665 2673
2666 // Map content-specific attributes based on routing IDs or browser plugin 2674 // Map content-specific attributes based on routing IDs or browser plugin
(...skipping 24 matching lines...) Expand all
2691 2699
2692 // Copy the common fields. 2700 // Copy the common fields.
2693 *dst = src; 2701 *dst = src;
2694 2702
2695 if (src.routing_id != -1) 2703 if (src.routing_id != -1)
2696 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); 2704 dst->tree_id = RoutingIDToAXTreeID(src.routing_id);
2697 2705
2698 if (src.parent_routing_id != -1) 2706 if (src.parent_routing_id != -1)
2699 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); 2707 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id);
2700 2708
2709 if (browser_plugin_embedder_ax_tree_id_ != AXTreeIDRegistry::kNoAXTreeID)
2710 dst->parent_tree_id = browser_plugin_embedder_ax_tree_id_;
2711
2701 // If this is not the root frame tree node, we're done. 2712 // If this is not the root frame tree node, we're done.
2702 if (frame_tree_node()->parent()) 2713 if (frame_tree_node()->parent())
2703 return; 2714 return;
2704 2715
2705 // For the root frame tree node, also store the AXTreeID of the focused frame. 2716 // For the root frame tree node, also store the AXTreeID of the focused frame.
2706 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); 2717 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame();
2707 if (!focused_frame_tree_node) 2718 if (!focused_frame_tree_node)
2708 return; 2719 return;
2709 RenderFrameHostImpl* focused_frame = 2720 RenderFrameHostImpl* focused_frame =
2710 focused_frame_tree_node->current_frame_host(); 2721 focused_frame_tree_node->current_frame_host();
2711 DCHECK(focused_frame); 2722 DCHECK(focused_frame);
2712 dst->focused_tree_id = focused_frame->GetAXTreeID(); 2723 dst->focused_tree_id = focused_frame->GetAXTreeID();
2713 } 2724 }
2714 2725
2715 } // namespace content 2726 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698