| 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 <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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 541 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
| 542 OnBeginNavigation) | 542 OnBeginNavigation) |
| 543 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) | 543 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) |
| 544 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 544 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
| 545 OnTextSurroundingSelectionResponse) | 545 OnTextSurroundingSelectionResponse) |
| 546 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 546 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
| 547 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 547 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
| 548 OnAccessibilityLocationChanges) | 548 OnAccessibilityLocationChanges) |
| 549 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, | 549 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, |
| 550 OnAccessibilityFindInPageResult) | 550 OnAccessibilityFindInPageResult) |
| 551 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_ChildFrameHitTestResult, |
| 552 OnAccessibilityChildFrameHitTestResult) |
| 551 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, | 553 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, |
| 552 OnAccessibilitySnapshotResponse) | 554 OnAccessibilitySnapshotResponse) |
| 553 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) | 555 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) |
| 554 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) | 556 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) |
| 555 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) | 557 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) |
| 556 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, | 558 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, |
| 557 OnDidChangeLoadProgress) | 559 OnDidChangeLoadProgress) |
| 558 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse, | 560 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse, |
| 559 OnSerializeAsMHTMLResponse) | 561 OnSerializeAsMHTMLResponse) |
| 560 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 562 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 browser_accessibility_manager_->SnapshotAXTreeForTesting())); | 1699 browser_accessibility_manager_->SnapshotAXTreeForTesting())); |
| 1698 } else { | 1700 } else { |
| 1699 ax_tree_for_testing_.reset(new ui::AXTree()); | 1701 ax_tree_for_testing_.reset(new ui::AXTree()); |
| 1700 CHECK(ax_tree_for_testing_->Unserialize(detail.update)) | 1702 CHECK(ax_tree_for_testing_->Unserialize(detail.update)) |
| 1701 << ax_tree_for_testing_->error(); | 1703 << ax_tree_for_testing_->error(); |
| 1702 } | 1704 } |
| 1703 } else { | 1705 } else { |
| 1704 CHECK(ax_tree_for_testing_->Unserialize(detail.update)) | 1706 CHECK(ax_tree_for_testing_->Unserialize(detail.update)) |
| 1705 << ax_tree_for_testing_->error(); | 1707 << ax_tree_for_testing_->error(); |
| 1706 } | 1708 } |
| 1707 accessibility_testing_callback_.Run(detail.event_type, detail.id); | 1709 accessibility_testing_callback_.Run(this, detail.event_type, detail.id); |
| 1708 } | 1710 } |
| 1709 } | 1711 } |
| 1710 } | 1712 } |
| 1711 | 1713 |
| 1712 // Always send an ACK or the renderer can be in a bad state. | 1714 // Always send an ACK or the renderer can be in a bad state. |
| 1713 Send(new AccessibilityMsg_Events_ACK(routing_id_)); | 1715 Send(new AccessibilityMsg_Events_ACK(routing_id_)); |
| 1714 } | 1716 } |
| 1715 | 1717 |
| 1716 void RenderFrameHostImpl::OnAccessibilityLocationChanges( | 1718 void RenderFrameHostImpl::OnAccessibilityLocationChanges( |
| 1717 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params) { | 1719 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1739 BrowserAccessibilityManager* manager = | 1741 BrowserAccessibilityManager* manager = |
| 1740 GetOrCreateBrowserAccessibilityManager(); | 1742 GetOrCreateBrowserAccessibilityManager(); |
| 1741 if (manager) { | 1743 if (manager) { |
| 1742 manager->OnFindInPageResult( | 1744 manager->OnFindInPageResult( |
| 1743 params.request_id, params.match_index, params.start_id, | 1745 params.request_id, params.match_index, params.start_id, |
| 1744 params.start_offset, params.end_id, params.end_offset); | 1746 params.start_offset, params.end_id, params.end_offset); |
| 1745 } | 1747 } |
| 1746 } | 1748 } |
| 1747 } | 1749 } |
| 1748 | 1750 |
| 1751 void RenderFrameHostImpl::OnAccessibilityChildFrameHitTestResult( |
| 1752 const gfx::Point& point, |
| 1753 int hit_obj_id) { |
| 1754 if (browser_accessibility_manager_) { |
| 1755 browser_accessibility_manager_->OnChildFrameHitTestResult(point, |
| 1756 hit_obj_id); |
| 1757 } |
| 1758 } |
| 1759 |
| 1749 void RenderFrameHostImpl::OnAccessibilitySnapshotResponse( | 1760 void RenderFrameHostImpl::OnAccessibilitySnapshotResponse( |
| 1750 int callback_id, | 1761 int callback_id, |
| 1751 const AXContentTreeUpdate& snapshot) { | 1762 const AXContentTreeUpdate& snapshot) { |
| 1752 const auto& it = ax_tree_snapshot_callbacks_.find(callback_id); | 1763 const auto& it = ax_tree_snapshot_callbacks_.find(callback_id); |
| 1753 if (it != ax_tree_snapshot_callbacks_.end()) { | 1764 if (it != ax_tree_snapshot_callbacks_.end()) { |
| 1754 ui::AXTreeUpdate dst_snapshot; | 1765 ui::AXTreeUpdate dst_snapshot; |
| 1755 dst_snapshot.nodes.resize(snapshot.nodes.size()); | 1766 dst_snapshot.nodes.resize(snapshot.nodes.size()); |
| 1756 for (size_t i = 0; i < snapshot.nodes.size(); ++i) { | 1767 for (size_t i = 0; i < snapshot.nodes.size(); ++i) { |
| 1757 AXContentNodeDataToAXNodeData(snapshot.nodes[i], | 1768 AXContentNodeDataToAXNodeData(snapshot.nodes[i], |
| 1758 &dst_snapshot.nodes[i]); | 1769 &dst_snapshot.nodes[i]); |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 | 2417 |
| 2407 void RenderFrameHostImpl::RequestAXTreeSnapshot( | 2418 void RenderFrameHostImpl::RequestAXTreeSnapshot( |
| 2408 AXTreeSnapshotCallback callback) { | 2419 AXTreeSnapshotCallback callback) { |
| 2409 static int next_id = 1; | 2420 static int next_id = 1; |
| 2410 int callback_id = next_id++; | 2421 int callback_id = next_id++; |
| 2411 Send(new AccessibilityMsg_SnapshotTree(routing_id_, callback_id)); | 2422 Send(new AccessibilityMsg_SnapshotTree(routing_id_, callback_id)); |
| 2412 ax_tree_snapshot_callbacks_.insert(std::make_pair(callback_id, callback)); | 2423 ax_tree_snapshot_callbacks_.insert(std::make_pair(callback_id, callback)); |
| 2413 } | 2424 } |
| 2414 | 2425 |
| 2415 void RenderFrameHostImpl::SetAccessibilityCallbackForTesting( | 2426 void RenderFrameHostImpl::SetAccessibilityCallbackForTesting( |
| 2416 const base::Callback<void(ui::AXEvent, int)>& callback) { | 2427 const base::Callback<void(RenderFrameHostImpl*, ui::AXEvent, int)>& |
| 2428 callback) { |
| 2417 accessibility_testing_callback_ = callback; | 2429 accessibility_testing_callback_ = callback; |
| 2418 } | 2430 } |
| 2419 | 2431 |
| 2420 void RenderFrameHostImpl::UpdateAXTreeData() { | 2432 void RenderFrameHostImpl::UpdateAXTreeData() { |
| 2421 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); | 2433 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); |
| 2422 if (accessibility_mode == AccessibilityModeOff || | 2434 if (accessibility_mode == AccessibilityModeOff || |
| 2423 !RenderFrameHostImpl::IsRFHStateActive(rfh_state())) { | 2435 !RenderFrameHostImpl::IsRFHStateActive(rfh_state())) { |
| 2424 return; | 2436 return; |
| 2425 } | 2437 } |
| 2426 | 2438 |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2731 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); | 2743 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); |
| 2732 if (!focused_frame_tree_node) | 2744 if (!focused_frame_tree_node) |
| 2733 return; | 2745 return; |
| 2734 RenderFrameHostImpl* focused_frame = | 2746 RenderFrameHostImpl* focused_frame = |
| 2735 focused_frame_tree_node->current_frame_host(); | 2747 focused_frame_tree_node->current_frame_host(); |
| 2736 DCHECK(focused_frame); | 2748 DCHECK(focused_frame); |
| 2737 dst->focused_tree_id = focused_frame->GetAXTreeID(); | 2749 dst->focused_tree_id = focused_frame->GetAXTreeID(); |
| 2738 } | 2750 } |
| 2739 | 2751 |
| 2740 } // namespace content | 2752 } // namespace content |
| OLD | NEW |