Chromium Code Reviews| 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 540 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 540 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
| 541 OnBeginNavigation) | 541 OnBeginNavigation) |
| 542 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) | 542 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) |
| 543 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 543 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
| 544 OnTextSurroundingSelectionResponse) | 544 OnTextSurroundingSelectionResponse) |
| 545 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 545 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
| 546 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 546 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
| 547 OnAccessibilityLocationChanges) | 547 OnAccessibilityLocationChanges) |
| 548 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, | 548 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult, |
| 549 OnAccessibilityFindInPageResult) | 549 OnAccessibilityFindInPageResult) |
| 550 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_ChildFrameHitTestResult, | |
| 551 OnAccessibilityChildFrameHitTestResult) | |
| 550 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, | 552 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, |
| 551 OnAccessibilitySnapshotResponse) | 553 OnAccessibilitySnapshotResponse) |
| 552 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) | 554 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) |
| 553 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) | 555 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) |
| 554 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) | 556 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) |
| 555 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, | 557 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, |
| 556 OnDidChangeLoadProgress) | 558 OnDidChangeLoadProgress) |
| 557 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse, | 559 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse, |
| 558 OnSerializeAsMHTMLResponse) | 560 OnSerializeAsMHTMLResponse) |
| 559 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 561 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1686 browser_accessibility_manager_->SnapshotAXTreeForTesting())); | 1688 browser_accessibility_manager_->SnapshotAXTreeForTesting())); |
| 1687 } else { | 1689 } else { |
| 1688 ax_tree_for_testing_.reset(new ui::AXTree()); | 1690 ax_tree_for_testing_.reset(new ui::AXTree()); |
| 1689 CHECK(ax_tree_for_testing_->Unserialize(detail.update)) | 1691 CHECK(ax_tree_for_testing_->Unserialize(detail.update)) |
| 1690 << ax_tree_for_testing_->error(); | 1692 << ax_tree_for_testing_->error(); |
| 1691 } | 1693 } |
| 1692 } else { | 1694 } else { |
| 1693 CHECK(ax_tree_for_testing_->Unserialize(detail.update)) | 1695 CHECK(ax_tree_for_testing_->Unserialize(detail.update)) |
| 1694 << ax_tree_for_testing_->error(); | 1696 << ax_tree_for_testing_->error(); |
| 1695 } | 1697 } |
| 1696 accessibility_testing_callback_.Run(detail.event_type, detail.id); | 1698 accessibility_testing_callback_.Run(this, detail.event_type, detail.id); |
| 1697 } | 1699 } |
| 1698 } | 1700 } |
| 1699 } | 1701 } |
| 1700 | 1702 |
| 1701 // Always send an ACK or the renderer can be in a bad state. | 1703 // Always send an ACK or the renderer can be in a bad state. |
| 1702 Send(new AccessibilityMsg_Events_ACK(routing_id_)); | 1704 Send(new AccessibilityMsg_Events_ACK(routing_id_)); |
| 1703 } | 1705 } |
| 1704 | 1706 |
| 1705 void RenderFrameHostImpl::OnAccessibilityLocationChanges( | 1707 void RenderFrameHostImpl::OnAccessibilityLocationChanges( |
| 1706 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params) { | 1708 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params) { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1728 BrowserAccessibilityManager* manager = | 1730 BrowserAccessibilityManager* manager = |
| 1729 GetOrCreateBrowserAccessibilityManager(); | 1731 GetOrCreateBrowserAccessibilityManager(); |
| 1730 if (manager) { | 1732 if (manager) { |
| 1731 manager->OnFindInPageResult( | 1733 manager->OnFindInPageResult( |
| 1732 params.request_id, params.match_index, params.start_id, | 1734 params.request_id, params.match_index, params.start_id, |
| 1733 params.start_offset, params.end_id, params.end_offset); | 1735 params.start_offset, params.end_id, params.end_offset); |
| 1734 } | 1736 } |
| 1735 } | 1737 } |
| 1736 } | 1738 } |
| 1737 | 1739 |
| 1740 void RenderFrameHostImpl::OnAccessibilityChildFrameHitTestResult( | |
| 1741 const gfx::Point& point, int hit_obj_id) { | |
|
nasko
2016/03/30 21:01:41
style: Each param on a new line.
dmazzoni
2016/03/31 16:15:54
Done.
| |
| 1742 if (browser_accessibility_manager_) { | |
| 1743 browser_accessibility_manager_->OnChildFrameHitTestResult( | |
| 1744 point, hit_obj_id); | |
| 1745 } | |
| 1746 } | |
| 1747 | |
| 1738 void RenderFrameHostImpl::OnAccessibilitySnapshotResponse( | 1748 void RenderFrameHostImpl::OnAccessibilitySnapshotResponse( |
| 1739 int callback_id, | 1749 int callback_id, |
| 1740 const AXContentTreeUpdate& snapshot) { | 1750 const AXContentTreeUpdate& snapshot) { |
| 1741 const auto& it = ax_tree_snapshot_callbacks_.find(callback_id); | 1751 const auto& it = ax_tree_snapshot_callbacks_.find(callback_id); |
| 1742 if (it != ax_tree_snapshot_callbacks_.end()) { | 1752 if (it != ax_tree_snapshot_callbacks_.end()) { |
| 1743 ui::AXTreeUpdate dst_snapshot; | 1753 ui::AXTreeUpdate dst_snapshot; |
| 1744 dst_snapshot.nodes.resize(snapshot.nodes.size()); | 1754 dst_snapshot.nodes.resize(snapshot.nodes.size()); |
| 1745 for (size_t i = 0; i < snapshot.nodes.size(); ++i) { | 1755 for (size_t i = 0; i < snapshot.nodes.size(); ++i) { |
| 1746 AXContentNodeDataToAXNodeData(snapshot.nodes[i], | 1756 AXContentNodeDataToAXNodeData(snapshot.nodes[i], |
| 1747 &dst_snapshot.nodes[i]); | 1757 &dst_snapshot.nodes[i]); |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2395 | 2405 |
| 2396 void RenderFrameHostImpl::RequestAXTreeSnapshot( | 2406 void RenderFrameHostImpl::RequestAXTreeSnapshot( |
| 2397 AXTreeSnapshotCallback callback) { | 2407 AXTreeSnapshotCallback callback) { |
| 2398 static int next_id = 1; | 2408 static int next_id = 1; |
| 2399 int callback_id = next_id++; | 2409 int callback_id = next_id++; |
| 2400 Send(new AccessibilityMsg_SnapshotTree(routing_id_, callback_id)); | 2410 Send(new AccessibilityMsg_SnapshotTree(routing_id_, callback_id)); |
| 2401 ax_tree_snapshot_callbacks_.insert(std::make_pair(callback_id, callback)); | 2411 ax_tree_snapshot_callbacks_.insert(std::make_pair(callback_id, callback)); |
| 2402 } | 2412 } |
| 2403 | 2413 |
| 2404 void RenderFrameHostImpl::SetAccessibilityCallbackForTesting( | 2414 void RenderFrameHostImpl::SetAccessibilityCallbackForTesting( |
| 2405 const base::Callback<void(ui::AXEvent, int)>& callback) { | 2415 const base::Callback<void(RenderFrameHostImpl*, |
| 2416 ui::AXEvent, | |
| 2417 int)>& callback) { | |
| 2406 accessibility_testing_callback_ = callback; | 2418 accessibility_testing_callback_ = callback; |
| 2407 } | 2419 } |
| 2408 | 2420 |
| 2409 void RenderFrameHostImpl::UpdateAXTreeData() { | 2421 void RenderFrameHostImpl::UpdateAXTreeData() { |
| 2410 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); | 2422 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); |
| 2411 if (accessibility_mode == AccessibilityModeOff || | 2423 if (accessibility_mode == AccessibilityModeOff || |
| 2412 !RenderFrameHostImpl::IsRFHStateActive(rfh_state())) { | 2424 !RenderFrameHostImpl::IsRFHStateActive(rfh_state())) { |
| 2413 return; | 2425 return; |
| 2414 } | 2426 } |
| 2415 | 2427 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2715 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); | 2727 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); |
| 2716 if (!focused_frame_tree_node) | 2728 if (!focused_frame_tree_node) |
| 2717 return; | 2729 return; |
| 2718 RenderFrameHostImpl* focused_frame = | 2730 RenderFrameHostImpl* focused_frame = |
| 2719 focused_frame_tree_node->current_frame_host(); | 2731 focused_frame_tree_node->current_frame_host(); |
| 2720 DCHECK(focused_frame); | 2732 DCHECK(focused_frame); |
| 2721 dst->focused_tree_id = focused_frame->GetAXTreeID(); | 2733 dst->focused_tree_id = focused_frame->GetAXTreeID(); |
| 2722 } | 2734 } |
| 2723 | 2735 |
| 2724 } // namespace content | 2736 } // namespace content |
| OLD | NEW |