| 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, | 643 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, |
| 644 OnDidAccessInitialDocument) | 644 OnDidAccessInitialDocument) |
| 645 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) | 645 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) |
| 646 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeName, OnDidChangeName) | 646 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeName, OnDidChangeName) |
| 647 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAddContentSecurityPolicy, | 647 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAddContentSecurityPolicy, |
| 648 OnDidAddContentSecurityPolicy) | 648 OnDidAddContentSecurityPolicy) |
| 649 IPC_MESSAGE_HANDLER(FrameHostMsg_EnforceInsecureRequestPolicy, | 649 IPC_MESSAGE_HANDLER(FrameHostMsg_EnforceInsecureRequestPolicy, |
| 650 OnEnforceInsecureRequestPolicy) | 650 OnEnforceInsecureRequestPolicy) |
| 651 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateToUniqueOrigin, | 651 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateToUniqueOrigin, |
| 652 OnUpdateToUniqueOrigin) | 652 OnUpdateToUniqueOrigin) |
| 653 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAssignPageId, OnDidAssignPageId) | |
| 654 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeSandboxFlags, | 653 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeSandboxFlags, |
| 655 OnDidChangeSandboxFlags) | 654 OnDidChangeSandboxFlags) |
| 656 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeFrameOwnerProperties, | 655 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeFrameOwnerProperties, |
| 657 OnDidChangeFrameOwnerProperties) | 656 OnDidChangeFrameOwnerProperties) |
| 658 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) | 657 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) |
| 659 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) | 658 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) |
| 660 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, | 659 IPC_MESSAGE_HANDLER(FrameHostMsg_BeginNavigation, |
| 661 OnBeginNavigation) | 660 OnBeginNavigation) |
| 662 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) | 661 IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad) |
| 663 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, | 662 IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse, |
| (...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1722 } | 1721 } |
| 1723 | 1722 |
| 1724 void RenderFrameHostImpl::OnUpdateToUniqueOrigin( | 1723 void RenderFrameHostImpl::OnUpdateToUniqueOrigin( |
| 1725 bool is_potentially_trustworthy_unique_origin) { | 1724 bool is_potentially_trustworthy_unique_origin) { |
| 1726 url::Origin origin; | 1725 url::Origin origin; |
| 1727 DCHECK(origin.unique()); | 1726 DCHECK(origin.unique()); |
| 1728 frame_tree_node()->SetCurrentOrigin(origin, | 1727 frame_tree_node()->SetCurrentOrigin(origin, |
| 1729 is_potentially_trustworthy_unique_origin); | 1728 is_potentially_trustworthy_unique_origin); |
| 1730 } | 1729 } |
| 1731 | 1730 |
| 1732 void RenderFrameHostImpl::OnDidAssignPageId(int32_t page_id) { | |
| 1733 // Update the RVH's current page ID so that future IPCs from the renderer | |
| 1734 // correspond to the new page. | |
| 1735 render_view_host_->page_id_ = page_id; | |
| 1736 } | |
| 1737 | |
| 1738 FrameTreeNode* RenderFrameHostImpl::FindAndVerifyChild( | 1731 FrameTreeNode* RenderFrameHostImpl::FindAndVerifyChild( |
| 1739 int32_t child_frame_routing_id, | 1732 int32_t child_frame_routing_id, |
| 1740 bad_message::BadMessageReason reason) { | 1733 bad_message::BadMessageReason reason) { |
| 1741 FrameTreeNode* child = frame_tree_node()->frame_tree()->FindByRoutingID( | 1734 FrameTreeNode* child = frame_tree_node()->frame_tree()->FindByRoutingID( |
| 1742 GetProcess()->GetID(), child_frame_routing_id); | 1735 GetProcess()->GetID(), child_frame_routing_id); |
| 1743 // A race can result in |child| to be nullptr. Avoid killing the renderer in | 1736 // A race can result in |child| to be nullptr. Avoid killing the renderer in |
| 1744 // that case. | 1737 // that case. |
| 1745 if (child && child->parent() != frame_tree_node()) { | 1738 if (child && child->parent() != frame_tree_node()) { |
| 1746 bad_message::ReceivedBadMessage(GetProcess(), reason); | 1739 bad_message::ReceivedBadMessage(GetProcess(), reason); |
| 1747 return nullptr; | 1740 return nullptr; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 blink::WebTextDirection title_direction) { | 1785 blink::WebTextDirection title_direction) { |
| 1793 // This message should only be sent for top-level frames. | 1786 // This message should only be sent for top-level frames. |
| 1794 if (frame_tree_node_->parent()) | 1787 if (frame_tree_node_->parent()) |
| 1795 return; | 1788 return; |
| 1796 | 1789 |
| 1797 if (title.length() > kMaxTitleChars) { | 1790 if (title.length() > kMaxTitleChars) { |
| 1798 NOTREACHED() << "Renderer sent too many characters in title."; | 1791 NOTREACHED() << "Renderer sent too many characters in title."; |
| 1799 return; | 1792 return; |
| 1800 } | 1793 } |
| 1801 | 1794 |
| 1802 delegate_->UpdateTitle(this, render_view_host_->page_id_, title, | 1795 delegate_->UpdateTitle( |
| 1803 WebTextDirectionToChromeTextDirection( | 1796 this, title, WebTextDirectionToChromeTextDirection(title_direction)); |
| 1804 title_direction)); | |
| 1805 } | 1797 } |
| 1806 | 1798 |
| 1807 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { | 1799 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { |
| 1808 // This message is only sent for top-level frames. TODO(avi): when frame tree | 1800 // This message is only sent for top-level frames. TODO(avi): when frame tree |
| 1809 // mirroring works correctly, add a check here to enforce it. | 1801 // mirroring works correctly, add a check here to enforce it. |
| 1810 delegate_->UpdateEncoding(this, encoding_name); | 1802 delegate_->UpdateEncoding(this, encoding_name); |
| 1811 } | 1803 } |
| 1812 | 1804 |
| 1813 void RenderFrameHostImpl::OnBeginNavigation( | 1805 void RenderFrameHostImpl::OnBeginNavigation( |
| 1814 const CommonNavigationParams& common_params, | 1806 const CommonNavigationParams& common_params, |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3153 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3145 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 3154 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3146 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 3155 return web_bluetooth_service_.get(); | 3147 return web_bluetooth_service_.get(); |
| 3156 } | 3148 } |
| 3157 | 3149 |
| 3158 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3150 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 3159 web_bluetooth_service_.reset(); | 3151 web_bluetooth_service_.reset(); |
| 3160 } | 3152 } |
| 3161 | 3153 |
| 3162 } // namespace content | 3154 } // namespace content |
| OLD | NEW |