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