| 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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 // Don't continue looking for someone to handle it. | 883 // Don't continue looking for someone to handle it. |
| 884 return true; | 884 return true; |
| 885 } | 885 } |
| 886 } | 886 } |
| 887 | 887 |
| 888 if (delegate_->OnMessageReceived(this, msg)) | 888 if (delegate_->OnMessageReceived(this, msg)) |
| 889 return true; | 889 return true; |
| 890 | 890 |
| 891 bool handled = true; | 891 bool handled = true; |
| 892 IPC_BEGIN_MESSAGE_MAP(RenderViewHostImpl, msg) | 892 IPC_BEGIN_MESSAGE_MAP(RenderViewHostImpl, msg) |
| 893 IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone) |
| 893 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnShowView) | 894 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnShowView) |
| 894 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) | 895 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) |
| 895 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, | 896 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, |
| 896 OnShowFullscreenWidget) | 897 OnShowFullscreenWidget) |
| 897 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal) | 898 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal) |
| 898 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) | 899 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) |
| 899 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) | |
| 900 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) | 900 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) |
| 901 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) | 901 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) |
| 902 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) | 902 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) |
| 903 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) | 903 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) |
| 904 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, | 904 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, |
| 905 OnDocumentAvailableInMainFrame) | 905 OnDocumentAvailableInMainFrame) |
| 906 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, | 906 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, |
| 907 OnDidContentsPreferredSizeChange) | 907 OnDidContentsPreferredSizeChange) |
| 908 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, | 908 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, |
| 909 OnRouteCloseEvent) | 909 OnRouteCloseEvent) |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 void RenderViewHostImpl::OnRenderViewReady() { | 1056 void RenderViewHostImpl::OnRenderViewReady() { |
| 1057 render_view_termination_status_ = base::TERMINATION_STATUS_STILL_RUNNING; | 1057 render_view_termination_status_ = base::TERMINATION_STATUS_STILL_RUNNING; |
| 1058 SendScreenRects(); | 1058 SendScreenRects(); |
| 1059 WasResized(); | 1059 WasResized(); |
| 1060 delegate_->RenderViewReady(this); | 1060 delegate_->RenderViewReady(this); |
| 1061 } | 1061 } |
| 1062 | 1062 |
| 1063 void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) { | 1063 void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) { |
| 1064 // Keep the termination status so we can get at it later when we | 1064 // Do nothing, otherwise RenderWidgetHostImpl will assume it is not a |
| 1065 // need to know why it died. | 1065 // RenderViewHostImpl and destroy itself. |
| 1066 render_view_termination_status_ = | 1066 // TODO(nasko): Remove this hack once RenderViewHost and RenderWidgetHost are |
| 1067 static_cast<base::TerminationStatus>(status); | 1067 // decoupled. |
| 1068 | |
| 1069 // Reset frame tree state associated with this process. This must happen | |
| 1070 // before RenderViewTerminated because observers expect the subframes of any | |
| 1071 // affected frames to be cleared first. | |
| 1072 delegate_->GetFrameTree()->RenderProcessGone(this); | |
| 1073 | |
| 1074 // Our base class RenderWidgetHost needs to reset some stuff. | |
| 1075 RendererExited(render_view_termination_status_, exit_code); | |
| 1076 | |
| 1077 delegate_->RenderViewTerminated(this, | |
| 1078 static_cast<base::TerminationStatus>(status), | |
| 1079 exit_code); | |
| 1080 } | 1068 } |
| 1081 | 1069 |
| 1082 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { | 1070 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { |
| 1083 // If the following DCHECK fails, you have encountered a tricky edge-case that | 1071 // If the following DCHECK fails, you have encountered a tricky edge-case that |
| 1084 // has evaded reproduction for a very long time. Please report what you were | 1072 // has evaded reproduction for a very long time. Please report what you were |
| 1085 // doing on http://crbug.com/407376, whether or not you can reproduce the | 1073 // doing on http://crbug.com/407376, whether or not you can reproduce the |
| 1086 // failure. | 1074 // failure. |
| 1087 DCHECK_EQ(page_id, page_id_); | 1075 DCHECK_EQ(page_id, page_id_); |
| 1088 | 1076 |
| 1089 // Without this check, the renderer can trick the browser into using | 1077 // Without this check, the renderer can trick the browser into using |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1482 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1470 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 1483 | 1471 |
| 1484 frame_tree->ResetForMainFrameSwap(); | 1472 frame_tree->ResetForMainFrameSwap(); |
| 1485 } | 1473 } |
| 1486 | 1474 |
| 1487 void RenderViewHostImpl::SelectWordAroundCaret() { | 1475 void RenderViewHostImpl::SelectWordAroundCaret() { |
| 1488 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1476 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
| 1489 } | 1477 } |
| 1490 | 1478 |
| 1491 } // namespace content | 1479 } // namespace content |
| OLD | NEW |