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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 bool hidden) | 177 bool hidden) |
178 : RenderWidgetHostImpl(widget_delegate, | 178 : RenderWidgetHostImpl(widget_delegate, |
179 instance->GetProcess(), | 179 instance->GetProcess(), |
180 routing_id, | 180 routing_id, |
181 hidden), | 181 hidden), |
182 frames_ref_count_(0), | 182 frames_ref_count_(0), |
183 delegate_(delegate), | 183 delegate_(delegate), |
184 instance_(static_cast<SiteInstanceImpl*>(instance)), | 184 instance_(static_cast<SiteInstanceImpl*>(instance)), |
185 waiting_for_drag_context_response_(false), | 185 waiting_for_drag_context_response_(false), |
186 enabled_bindings_(0), | 186 enabled_bindings_(0), |
| 187 page_id_(-1), |
187 main_frame_routing_id_(main_frame_routing_id), | 188 main_frame_routing_id_(main_frame_routing_id), |
188 run_modal_reply_msg_(NULL), | 189 run_modal_reply_msg_(NULL), |
189 run_modal_opener_id_(MSG_ROUTING_NONE), | 190 run_modal_opener_id_(MSG_ROUTING_NONE), |
190 is_waiting_for_beforeunload_ack_(false), | 191 is_waiting_for_beforeunload_ack_(false), |
191 unload_ack_is_for_cross_site_transition_(false), | 192 unload_ack_is_for_cross_site_transition_(false), |
192 sudden_termination_allowed_(false), | 193 sudden_termination_allowed_(false), |
193 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 194 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
194 virtual_keyboard_requested_(false), | 195 virtual_keyboard_requested_(false), |
195 weak_factory_(this), | 196 weak_factory_(this), |
196 is_focused_element_editable_(false), | 197 is_focused_element_editable_(false), |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 | 1067 |
1067 // Our base class RenderWidgetHost needs to reset some stuff. | 1068 // Our base class RenderWidgetHost needs to reset some stuff. |
1068 RendererExited(render_view_termination_status_, exit_code); | 1069 RendererExited(render_view_termination_status_, exit_code); |
1069 | 1070 |
1070 delegate_->RenderViewTerminated(this, | 1071 delegate_->RenderViewTerminated(this, |
1071 static_cast<base::TerminationStatus>(status), | 1072 static_cast<base::TerminationStatus>(status), |
1072 exit_code); | 1073 exit_code); |
1073 } | 1074 } |
1074 | 1075 |
1075 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { | 1076 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { |
| 1077 CHECK_EQ(page_id_, page_id); |
1076 // Without this check, the renderer can trick the browser into using | 1078 // Without this check, the renderer can trick the browser into using |
1077 // filenames it can't access in a future session restore. | 1079 // filenames it can't access in a future session restore. |
1078 if (!CanAccessFilesOfPageState(state)) { | 1080 if (!CanAccessFilesOfPageState(state)) { |
1079 GetProcess()->ReceivedBadMessage(); | 1081 GetProcess()->ReceivedBadMessage(); |
1080 return; | 1082 return; |
1081 } | 1083 } |
1082 | 1084 |
1083 delegate_->UpdateState(this, page_id, state); | 1085 delegate_->UpdateState(this, page_id_, state); |
1084 } | 1086 } |
1085 | 1087 |
1086 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { | 1088 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { |
| 1089 CHECK_EQ(page_id_, page_id); |
1087 if (IsRVHStateActive(rvh_state_)) | 1090 if (IsRVHStateActive(rvh_state_)) |
1088 delegate_->UpdateTargetURL(page_id, url); | 1091 delegate_->UpdateTargetURL(page_id_, url); |
1089 | 1092 |
1090 // Send a notification back to the renderer that we are ready to | 1093 // Send a notification back to the renderer that we are ready to |
1091 // receive more target urls. | 1094 // receive more target urls. |
1092 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); | 1095 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); |
1093 } | 1096 } |
1094 | 1097 |
1095 void RenderViewHostImpl::OnClose() { | 1098 void RenderViewHostImpl::OnClose() { |
1096 // If the renderer is telling us to close, it has already run the unload | 1099 // If the renderer is telling us to close, it has already run the unload |
1097 // events, and we can take the fast path. | 1100 // events, and we can take the fast path. |
1098 ClosePageIgnoringUnloadEvents(); | 1101 ClosePageIgnoringUnloadEvents(); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1500 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1498 | 1501 |
1499 frame_tree->ResetForMainFrameSwap(); | 1502 frame_tree->ResetForMainFrameSwap(); |
1500 } | 1503 } |
1501 | 1504 |
1502 void RenderViewHostImpl::SelectWordAroundCaret() { | 1505 void RenderViewHostImpl::SelectWordAroundCaret() { |
1503 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1506 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1504 } | 1507 } |
1505 | 1508 |
1506 } // namespace content | 1509 } // namespace content |
OLD | NEW |