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 <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 OnCancelInitialHistoryLoad) | 713 OnCancelInitialHistoryLoad) |
714 IPC_MESSAGE_HANDLER(FrameHostMsg_DocumentOnLoadCompleted, | 714 IPC_MESSAGE_HANDLER(FrameHostMsg_DocumentOnLoadCompleted, |
715 OnDocumentOnLoadCompleted) | 715 OnDocumentOnLoadCompleted) |
716 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) | 716 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) |
717 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) | 717 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) |
718 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) | 718 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) |
719 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, | 719 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, |
720 OnJavaScriptExecuteResponse) | 720 OnJavaScriptExecuteResponse) |
721 IPC_MESSAGE_HANDLER(FrameHostMsg_VisualStateResponse, | 721 IPC_MESSAGE_HANDLER(FrameHostMsg_VisualStateResponse, |
722 OnVisualStateResponse) | 722 OnVisualStateResponse) |
| 723 IPC_MESSAGE_HANDLER(FrameHostMsg_SmartClipDataExtracted, |
| 724 OnSmartClipDataExtracted) |
723 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, | 725 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, |
724 OnRunJavaScriptMessage) | 726 OnRunJavaScriptMessage) |
725 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, | 727 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, |
726 OnRunBeforeUnloadConfirm) | 728 OnRunBeforeUnloadConfirm) |
727 IPC_MESSAGE_HANDLER(FrameHostMsg_RunFileChooser, OnRunFileChooser) | 729 IPC_MESSAGE_HANDLER(FrameHostMsg_RunFileChooser, OnRunFileChooser) |
728 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, | 730 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, |
729 OnDidAccessInitialDocument) | 731 OnDidAccessInitialDocument) |
730 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) | 732 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) |
731 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeName, OnDidChangeName) | 733 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeName, OnDidChangeName) |
732 IPC_MESSAGE_HANDLER(FrameHostMsg_DidSetFeaturePolicyHeader, | 734 IPC_MESSAGE_HANDLER(FrameHostMsg_DidSetFeaturePolicyHeader, |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 // Reset state for the current RenderFrameHost once the FrameTreeNode has been | 1546 // Reset state for the current RenderFrameHost once the FrameTreeNode has been |
1545 // reset. | 1547 // reset. |
1546 SetRenderFrameCreated(false); | 1548 SetRenderFrameCreated(false); |
1547 InvalidateMojoConnection(); | 1549 InvalidateMojoConnection(); |
1548 | 1550 |
1549 // Execute any pending AX tree snapshot callbacks with an empty response, | 1551 // Execute any pending AX tree snapshot callbacks with an empty response, |
1550 // since we're never going to get a response from this renderer. | 1552 // since we're never going to get a response from this renderer. |
1551 for (const auto& iter : ax_tree_snapshot_callbacks_) | 1553 for (const auto& iter : ax_tree_snapshot_callbacks_) |
1552 iter.second.Run(ui::AXTreeUpdate()); | 1554 iter.second.Run(ui::AXTreeUpdate()); |
1553 | 1555 |
| 1556 for (const auto& iter : smart_clip_callbacks_) |
| 1557 iter.second.Run(base::string16(), base::string16()); |
| 1558 |
1554 ax_tree_snapshot_callbacks_.clear(); | 1559 ax_tree_snapshot_callbacks_.clear(); |
| 1560 smart_clip_callbacks_.clear(); |
1555 javascript_callbacks_.clear(); | 1561 javascript_callbacks_.clear(); |
1556 visual_state_callbacks_.clear(); | 1562 visual_state_callbacks_.clear(); |
1557 form_field_data_callbacks_.clear(); | 1563 form_field_data_callbacks_.clear(); |
1558 | 1564 |
1559 // Ensure that future remote interface requests are associated with the new | 1565 // Ensure that future remote interface requests are associated with the new |
1560 // process's channel. | 1566 // process's channel. |
1561 remote_associated_interfaces_.reset(); | 1567 remote_associated_interfaces_.reset(); |
1562 | 1568 |
1563 if (!is_active()) { | 1569 if (!is_active()) { |
1564 // If the process has died, we don't need to wait for the swap out ack from | 1570 // If the process has died, we don't need to wait for the swap out ack from |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 std::map<int, JavaScriptResultCallback>::iterator it = | 1651 std::map<int, JavaScriptResultCallback>::iterator it = |
1646 javascript_callbacks_.find(id); | 1652 javascript_callbacks_.find(id); |
1647 if (it != javascript_callbacks_.end()) { | 1653 if (it != javascript_callbacks_.end()) { |
1648 it->second.Run(result_value); | 1654 it->second.Run(result_value); |
1649 javascript_callbacks_.erase(it); | 1655 javascript_callbacks_.erase(it); |
1650 } else { | 1656 } else { |
1651 NOTREACHED() << "Received script response for unknown request"; | 1657 NOTREACHED() << "Received script response for unknown request"; |
1652 } | 1658 } |
1653 } | 1659 } |
1654 | 1660 |
| 1661 void RenderFrameHostImpl::RequestSmartClipExtract(SmartClipCallback callback, |
| 1662 gfx::Rect rect) { |
| 1663 static uint32_t next_id = 1; |
| 1664 uint32_t key = next_id++; |
| 1665 Send(new FrameMsg_ExtractSmartClipData(routing_id_, key, rect)); |
| 1666 smart_clip_callbacks_.insert(std::make_pair(key, callback)); |
| 1667 } |
| 1668 |
| 1669 void RenderFrameHostImpl::OnSmartClipDataExtracted(uint32_t id, |
| 1670 base::string16 text, |
| 1671 base::string16 html) { |
| 1672 auto it = smart_clip_callbacks_.find(id); |
| 1673 if (it != smart_clip_callbacks_.end()) { |
| 1674 it->second.Run(text, html); |
| 1675 smart_clip_callbacks_.erase(it); |
| 1676 } else { |
| 1677 NOTREACHED() << "Received smartclip data response for unknown request"; |
| 1678 } |
| 1679 } |
| 1680 |
1655 void RenderFrameHostImpl::OnVisualStateResponse(uint64_t id) { | 1681 void RenderFrameHostImpl::OnVisualStateResponse(uint64_t id) { |
1656 auto it = visual_state_callbacks_.find(id); | 1682 auto it = visual_state_callbacks_.find(id); |
1657 if (it != visual_state_callbacks_.end()) { | 1683 if (it != visual_state_callbacks_.end()) { |
1658 it->second.Run(true); | 1684 it->second.Run(true); |
1659 visual_state_callbacks_.erase(it); | 1685 visual_state_callbacks_.erase(it); |
1660 } else { | 1686 } else { |
1661 NOTREACHED() << "Received script response for unknown request"; | 1687 NOTREACHED() << "Received script response for unknown request"; |
1662 } | 1688 } |
1663 } | 1689 } |
1664 | 1690 |
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3456 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3482 // There is no pending NavigationEntry in these cases, so pass 0 as the |
3457 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3483 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
3458 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3484 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
3459 return NavigationHandleImpl::Create( | 3485 return NavigationHandleImpl::Create( |
3460 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, | 3486 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, |
3461 params.was_within_same_page, base::TimeTicks::Now(), | 3487 params.was_within_same_page, base::TimeTicks::Now(), |
3462 entry_id_for_data_nav, false); // started_from_context_menu | 3488 entry_id_for_data_nav, false); // started_from_context_menu |
3463 } | 3489 } |
3464 | 3490 |
3465 } // namespace content | 3491 } // namespace content |
OLD | NEW |