OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 | 762 |
763 if (delegate_->OnMessageReceived(this, msg)) | 763 if (delegate_->OnMessageReceived(this, msg)) |
764 return true; | 764 return true; |
765 | 765 |
766 bool handled = true; | 766 bool handled = true; |
767 IPC_BEGIN_MESSAGE_MAP(RenderViewHostImpl, msg) | 767 IPC_BEGIN_MESSAGE_MAP(RenderViewHostImpl, msg) |
768 IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone) | 768 IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone) |
769 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) | 769 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) |
770 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, | 770 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, |
771 OnShowFullscreenWidget) | 771 OnShowFullscreenWidget) |
772 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) | |
773 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) | 772 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) |
774 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) | 773 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) |
775 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) | 774 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) |
776 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, | 775 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, |
777 OnDocumentAvailableInMainFrame) | 776 OnDocumentAvailableInMainFrame) |
778 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, | 777 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, |
779 OnDidContentsPreferredSizeChange) | 778 OnDidContentsPreferredSizeChange) |
780 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, | 779 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, |
781 OnRouteCloseEvent) | 780 OnRouteCloseEvent) |
782 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 781 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 Send(new ViewMsg_Move_ACK(route_id)); | 825 Send(new ViewMsg_Move_ACK(route_id)); |
827 } | 826 } |
828 | 827 |
829 void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) { | 828 void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) { |
830 // Do nothing, otherwise RenderWidgetHostImpl will assume it is not a | 829 // Do nothing, otherwise RenderWidgetHostImpl will assume it is not a |
831 // RenderViewHostImpl and destroy itself. | 830 // RenderViewHostImpl and destroy itself. |
832 // TODO(nasko): Remove this hack once RenderViewHost and RenderWidgetHost are | 831 // TODO(nasko): Remove this hack once RenderViewHost and RenderWidgetHost are |
833 // decoupled. | 832 // decoupled. |
834 } | 833 } |
835 | 834 |
836 void RenderViewHostImpl::OnUpdateState(const PageState& state) { | |
837 // Without this check, the renderer can trick the browser into using | |
838 // filenames it can't access in a future session restore. | |
839 auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); | |
840 int child_id = GetProcess()->GetID(); | |
841 if (!policy->CanReadAllFiles(child_id, state.GetReferencedFiles())) { | |
842 bad_message::ReceivedBadMessage( | |
843 GetProcess(), bad_message::RVH_CAN_ACCESS_FILES_OF_PAGE_STATE); | |
844 return; | |
845 } | |
846 | |
847 delegate_->UpdateState(this, state); | |
848 } | |
849 | |
850 void RenderViewHostImpl::OnUpdateTargetURL(const GURL& url) { | 835 void RenderViewHostImpl::OnUpdateTargetURL(const GURL& url) { |
851 if (is_active_) | 836 if (is_active_) |
852 delegate_->UpdateTargetURL(this, url); | 837 delegate_->UpdateTargetURL(this, url); |
853 | 838 |
854 // Send a notification back to the renderer that we are ready to | 839 // Send a notification back to the renderer that we are ready to |
855 // receive more target urls. | 840 // receive more target urls. |
856 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); | 841 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); |
857 } | 842 } |
858 | 843 |
859 void RenderViewHostImpl::OnClose() { | 844 void RenderViewHostImpl::OnClose() { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 } else { | 997 } else { |
1013 render_view_ready_on_process_launch_ = true; | 998 render_view_ready_on_process_launch_ = true; |
1014 } | 999 } |
1015 } | 1000 } |
1016 | 1001 |
1017 void RenderViewHostImpl::RenderViewReady() { | 1002 void RenderViewHostImpl::RenderViewReady() { |
1018 delegate_->RenderViewReady(this); | 1003 delegate_->RenderViewReady(this); |
1019 } | 1004 } |
1020 | 1005 |
1021 } // namespace content | 1006 } // namespace content |
OLD | NEW |