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

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

Issue 1407413002: Move some AX attrs from AXNodeData to AXTreeData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 2 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 frame_tree_node_->ResetForNewProcess(); 1164 frame_tree_node_->ResetForNewProcess();
1165 1165
1166 // Reset state for the current RenderFrameHost once the FrameTreeNode has been 1166 // Reset state for the current RenderFrameHost once the FrameTreeNode has been
1167 // reset. 1167 // reset.
1168 SetRenderFrameCreated(false); 1168 SetRenderFrameCreated(false);
1169 InvalidateMojoConnection(); 1169 InvalidateMojoConnection();
1170 1170
1171 // Execute any pending AX tree snapshot callbacks with an empty response, 1171 // Execute any pending AX tree snapshot callbacks with an empty response,
1172 // since we're never going to get a response from this renderer. 1172 // since we're never going to get a response from this renderer.
1173 for (const auto& iter : ax_tree_snapshot_callbacks_) 1173 for (const auto& iter : ax_tree_snapshot_callbacks_)
1174 iter.second.Run(ui::AXTreeUpdate<ui::AXNodeData>()); 1174 iter.second.Run(ui::AXTreeUpdate());
1175 ax_tree_snapshot_callbacks_.clear(); 1175 ax_tree_snapshot_callbacks_.clear();
1176 1176
1177 // Note: don't add any more code at this point in the function because 1177 // Note: don't add any more code at this point in the function because
1178 // |this| may be deleted. Any additional cleanup should happen before 1178 // |this| may be deleted. Any additional cleanup should happen before
1179 // the last block of code here. 1179 // the last block of code here.
1180 } 1180 }
1181 1181
1182 void RenderFrameHostImpl::OnSwappedOut() { 1182 void RenderFrameHostImpl::OnSwappedOut() {
1183 // Ignore spurious swap out ack. 1183 // Ignore spurious swap out ack.
1184 if (rfh_state_ != STATE_PENDING_SWAP_OUT) 1184 if (rfh_state_ != STATE_PENDING_SWAP_OUT)
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 GetOrCreateBrowserAccessibilityManager(); 1419 GetOrCreateBrowserAccessibilityManager();
1420 1420
1421 std::vector<AXEventNotificationDetails> details; 1421 std::vector<AXEventNotificationDetails> details;
1422 details.reserve(params.size()); 1422 details.reserve(params.size());
1423 for (size_t i = 0; i < params.size(); ++i) { 1423 for (size_t i = 0; i < params.size(); ++i) {
1424 const AccessibilityHostMsg_EventParams& param = params[i]; 1424 const AccessibilityHostMsg_EventParams& param = params[i];
1425 AXEventNotificationDetails detail; 1425 AXEventNotificationDetails detail;
1426 detail.event_type = param.event_type; 1426 detail.event_type = param.event_type;
1427 detail.id = param.id; 1427 detail.id = param.id;
1428 detail.ax_tree_id = GetAXTreeID(); 1428 detail.ax_tree_id = GetAXTreeID();
1429 if (param.update.has_tree_data) {
1430 detail.update.has_tree_data = true;
1431 AXContentTreeDataToAXTreeData(param.update.tree_data,
1432 &detail.update.tree_data);
1433 }
1429 detail.update.node_id_to_clear = param.update.node_id_to_clear; 1434 detail.update.node_id_to_clear = param.update.node_id_to_clear;
1430 detail.update.nodes.resize(param.update.nodes.size()); 1435 detail.update.nodes.resize(param.update.nodes.size());
1431 for (size_t i = 0; i < param.update.nodes.size(); ++i) { 1436 for (size_t i = 0; i < param.update.nodes.size(); ++i) {
1432 AXContentNodeDataToAXNodeData(param.update.nodes[i], 1437 AXContentNodeDataToAXNodeData(param.update.nodes[i],
1433 &detail.update.nodes[i]); 1438 &detail.update.nodes[i]);
1434 } 1439 }
1435 details.push_back(detail); 1440 details.push_back(detail);
1436 } 1441 }
1437 1442
1438 if (accessibility_mode & AccessibilityModeFlagPlatform) { 1443 if (accessibility_mode & AccessibilityModeFlagPlatform) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 if (manager) { 1505 if (manager) {
1501 manager->OnFindInPageResult( 1506 manager->OnFindInPageResult(
1502 params.request_id, params.match_index, params.start_id, 1507 params.request_id, params.match_index, params.start_id,
1503 params.start_offset, params.end_id, params.end_offset); 1508 params.start_offset, params.end_id, params.end_offset);
1504 } 1509 }
1505 } 1510 }
1506 } 1511 }
1507 1512
1508 void RenderFrameHostImpl::OnAccessibilitySnapshotResponse( 1513 void RenderFrameHostImpl::OnAccessibilitySnapshotResponse(
1509 int callback_id, 1514 int callback_id,
1510 const ui::AXTreeUpdate<AXContentNodeData>& snapshot) { 1515 const AXContentTreeUpdate& snapshot) {
1511 const auto& it = ax_tree_snapshot_callbacks_.find(callback_id); 1516 const auto& it = ax_tree_snapshot_callbacks_.find(callback_id);
1512 if (it != ax_tree_snapshot_callbacks_.end()) { 1517 if (it != ax_tree_snapshot_callbacks_.end()) {
1513 ui::AXTreeUpdate<ui::AXNodeData> dst_snapshot; 1518 ui::AXTreeUpdate dst_snapshot;
1514 dst_snapshot.nodes.resize(snapshot.nodes.size()); 1519 dst_snapshot.nodes.resize(snapshot.nodes.size());
1515 for (size_t i = 0; i < snapshot.nodes.size(); ++i) { 1520 for (size_t i = 0; i < snapshot.nodes.size(); ++i) {
1516 AXContentNodeDataToAXNodeData(snapshot.nodes[i], 1521 AXContentNodeDataToAXNodeData(snapshot.nodes[i],
1517 &dst_snapshot.nodes[i]); 1522 &dst_snapshot.nodes[i]);
1518 } 1523 }
1524 if (snapshot.has_tree_data) {
1525 AXContentTreeDataToAXTreeData(snapshot.tree_data,
1526 &dst_snapshot.tree_data);
1527 }
1519 it->second.Run(dst_snapshot); 1528 it->second.Run(dst_snapshot);
1520 ax_tree_snapshot_callbacks_.erase(it); 1529 ax_tree_snapshot_callbacks_.erase(it);
1521 } else { 1530 } else {
1522 NOTREACHED() << "Received AX tree snapshot response for unknown id"; 1531 NOTREACHED() << "Received AX tree snapshot response for unknown id";
1523 } 1532 }
1524 } 1533 }
1525 1534
1526 void RenderFrameHostImpl::OnToggleFullscreen(bool enter_fullscreen) { 1535 void RenderFrameHostImpl::OnToggleFullscreen(bool enter_fullscreen) {
1527 if (enter_fullscreen) 1536 if (enter_fullscreen)
1528 delegate_->EnterFullscreenMode(GetLastCommittedURL().GetOrigin()); 1537 delegate_->EnterFullscreenMode(GetLastCommittedURL().GetOrigin());
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 ui::AXNodeData* dst) { 2254 ui::AXNodeData* dst) {
2246 // Copy the common fields. 2255 // Copy the common fields.
2247 *dst = src; 2256 *dst = src;
2248 2257
2249 // Map content-specific attributes based on routing IDs or browser plugin 2258 // Map content-specific attributes based on routing IDs or browser plugin
2250 // instance IDs to generic attributes with global AXTreeIDs. 2259 // instance IDs to generic attributes with global AXTreeIDs.
2251 for (auto iter : src.content_int_attributes) { 2260 for (auto iter : src.content_int_attributes) {
2252 AXContentIntAttribute attr = iter.first; 2261 AXContentIntAttribute attr = iter.first;
2253 int32 value = iter.second; 2262 int32 value = iter.second;
2254 switch (attr) { 2263 switch (attr) {
2255 case AX_CONTENT_ATTR_ROUTING_ID:
2256 dst->int_attributes.push_back(std::make_pair(
2257 ui::AX_ATTR_TREE_ID, RoutingIDToAXTreeID(value)));
2258 break;
2259 case AX_CONTENT_ATTR_PARENT_ROUTING_ID:
2260 dst->int_attributes.push_back(std::make_pair(
2261 ui::AX_ATTR_PARENT_TREE_ID, RoutingIDToAXTreeID(value)));
2262 break;
2263 case AX_CONTENT_ATTR_CHILD_ROUTING_ID: 2264 case AX_CONTENT_ATTR_CHILD_ROUTING_ID:
2264 dst->int_attributes.push_back(std::make_pair( 2265 dst->int_attributes.push_back(std::make_pair(
2265 ui::AX_ATTR_CHILD_TREE_ID, RoutingIDToAXTreeID(value))); 2266 ui::AX_ATTR_CHILD_TREE_ID, RoutingIDToAXTreeID(value)));
2266 break; 2267 break;
2267 case AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID: 2268 case AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID:
2268 dst->int_attributes.push_back(std::make_pair( 2269 dst->int_attributes.push_back(std::make_pair(
2269 ui::AX_ATTR_CHILD_TREE_ID, 2270 ui::AX_ATTR_CHILD_TREE_ID,
2270 BrowserPluginInstanceIDToAXTreeID(value))); 2271 BrowserPluginInstanceIDToAXTreeID(value)));
2271 break; 2272 break;
2272 case AX_CONTENT_INT_ATTRIBUTE_LAST: 2273 case AX_CONTENT_INT_ATTRIBUTE_LAST:
2273 NOTREACHED(); 2274 NOTREACHED();
2274 break; 2275 break;
2275 } 2276 }
2276 } 2277 }
2277 } 2278 }
2278 2279
2280 void RenderFrameHostImpl::AXContentTreeDataToAXTreeData(
2281 const AXContentTreeData& src,
2282 ui::AXTreeData* dst) {
2283 // Copy the common fields.
2284 *dst = src;
2285
2286 if (src.routing_id != -1)
2287 dst->tree_id = RoutingIDToAXTreeID(src.routing_id);
2288
2289 if (src.parent_routing_id != -1)
2290 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id);
2291 }
2292
2279 } // namespace content 2293 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698