| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 : RenderWidgetHostImpl(widget_delegate, | 183 : RenderWidgetHostImpl(widget_delegate, |
| 184 instance->GetProcess(), | 184 instance->GetProcess(), |
| 185 routing_id, | 185 routing_id, |
| 186 hidden), | 186 hidden), |
| 187 frames_ref_count_(0), | 187 frames_ref_count_(0), |
| 188 delegate_(delegate), | 188 delegate_(delegate), |
| 189 instance_(static_cast<SiteInstanceImpl*>(instance)), | 189 instance_(static_cast<SiteInstanceImpl*>(instance)), |
| 190 waiting_for_drag_context_response_(false), | 190 waiting_for_drag_context_response_(false), |
| 191 enabled_bindings_(0), | 191 enabled_bindings_(0), |
| 192 navigations_suspended_(false), | 192 navigations_suspended_(false), |
| 193 page_id_(-1), |
| 193 main_frame_routing_id_(main_frame_routing_id), | 194 main_frame_routing_id_(main_frame_routing_id), |
| 194 run_modal_reply_msg_(NULL), | 195 run_modal_reply_msg_(NULL), |
| 195 run_modal_opener_id_(MSG_ROUTING_NONE), | 196 run_modal_opener_id_(MSG_ROUTING_NONE), |
| 196 is_waiting_for_beforeunload_ack_(false), | 197 is_waiting_for_beforeunload_ack_(false), |
| 197 unload_ack_is_for_cross_site_transition_(false), | 198 unload_ack_is_for_cross_site_transition_(false), |
| 198 sudden_termination_allowed_(false), | 199 sudden_termination_allowed_(false), |
| 199 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 200 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 200 virtual_keyboard_requested_(false), | 201 virtual_keyboard_requested_(false), |
| 201 weak_factory_(this), | 202 weak_factory_(this), |
| 202 is_focused_element_editable_(false) { | 203 is_focused_element_editable_(false) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 DCHECK(GetProcess()->GetBrowserContext()); | 277 DCHECK(GetProcess()->GetBrowserContext()); |
| 277 | 278 |
| 278 renderer_initialized_ = true; | 279 renderer_initialized_ = true; |
| 279 | 280 |
| 280 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 281 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
| 281 surface_id(), GetCompositingSurface()); | 282 surface_id(), GetCompositingSurface()); |
| 282 | 283 |
| 283 // Ensure the RenderView starts with a next_page_id larger than any existing | 284 // Ensure the RenderView starts with a next_page_id larger than any existing |
| 284 // page ID it might be asked to render. | 285 // page ID it might be asked to render. |
| 285 int32 next_page_id = 1; | 286 int32 next_page_id = 1; |
| 286 if (max_page_id > -1) | 287 if (max_page_id > -1) { |
| 287 next_page_id = max_page_id + 1; | 288 next_page_id = max_page_id + 1; |
| 289 page_id_ = max_page_id; |
| 290 } |
| 288 | 291 |
| 289 ViewMsg_New_Params params; | 292 ViewMsg_New_Params params; |
| 290 params.renderer_preferences = | 293 params.renderer_preferences = |
| 291 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); | 294 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); |
| 292 params.web_preferences = delegate_->GetWebkitPrefs(); | 295 params.web_preferences = delegate_->GetWebkitPrefs(); |
| 293 params.view_id = GetRoutingID(); | 296 params.view_id = GetRoutingID(); |
| 294 params.main_frame_routing_id = main_frame_routing_id_; | 297 params.main_frame_routing_id = main_frame_routing_id_; |
| 295 params.surface_id = surface_id(); | 298 params.surface_id = surface_id(); |
| 296 params.session_storage_namespace_id = | 299 params.session_storage_namespace_id = |
| 297 delegate_->GetSessionStorageNamespace(instance_)->id(); | 300 delegate_->GetSessionStorageNamespace(instance_)->id(); |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 | 1107 |
| 1105 // Our base class RenderWidgetHost needs to reset some stuff. | 1108 // Our base class RenderWidgetHost needs to reset some stuff. |
| 1106 RendererExited(render_view_termination_status_, exit_code); | 1109 RendererExited(render_view_termination_status_, exit_code); |
| 1107 | 1110 |
| 1108 delegate_->RenderViewTerminated(this, | 1111 delegate_->RenderViewTerminated(this, |
| 1109 static_cast<base::TerminationStatus>(status), | 1112 static_cast<base::TerminationStatus>(status), |
| 1110 exit_code); | 1113 exit_code); |
| 1111 } | 1114 } |
| 1112 | 1115 |
| 1113 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { | 1116 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { |
| 1117 CHECK_EQ(page_id_, page_id); |
| 1114 // Without this check, the renderer can trick the browser into using | 1118 // Without this check, the renderer can trick the browser into using |
| 1115 // filenames it can't access in a future session restore. | 1119 // filenames it can't access in a future session restore. |
| 1116 if (!CanAccessFilesOfPageState(state)) { | 1120 if (!CanAccessFilesOfPageState(state)) { |
| 1117 GetProcess()->ReceivedBadMessage(); | 1121 GetProcess()->ReceivedBadMessage(); |
| 1118 return; | 1122 return; |
| 1119 } | 1123 } |
| 1120 | 1124 |
| 1121 delegate_->UpdateState(this, page_id, state); | 1125 delegate_->UpdateState(this, page_id_, state); |
| 1122 } | 1126 } |
| 1123 | 1127 |
| 1124 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { | 1128 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { |
| 1129 CHECK_EQ(page_id_, page_id); |
| 1125 if (IsRVHStateActive(rvh_state_)) | 1130 if (IsRVHStateActive(rvh_state_)) |
| 1126 delegate_->UpdateTargetURL(page_id, url); | 1131 delegate_->UpdateTargetURL(page_id_, url); |
| 1127 | 1132 |
| 1128 // Send a notification back to the renderer that we are ready to | 1133 // Send a notification back to the renderer that we are ready to |
| 1129 // receive more target urls. | 1134 // receive more target urls. |
| 1130 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); | 1135 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); |
| 1131 } | 1136 } |
| 1132 | 1137 |
| 1133 void RenderViewHostImpl::OnUpdateInspectorSetting( | 1138 void RenderViewHostImpl::OnUpdateInspectorSetting( |
| 1134 const std::string& key, const std::string& value) { | 1139 const std::string& key, const std::string& value) { |
| 1135 GetContentClient()->browser()->UpdateInspectorSetting( | 1140 GetContentClient()->browser()->UpdateInspectorSetting( |
| 1136 this, key, value); | 1141 this, key, value); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1587 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 1583 | 1588 |
| 1584 frame_tree->ResetForMainFrameSwap(); | 1589 frame_tree->ResetForMainFrameSwap(); |
| 1585 } | 1590 } |
| 1586 | 1591 |
| 1587 void RenderViewHostImpl::SelectWordAroundCaret() { | 1592 void RenderViewHostImpl::SelectWordAroundCaret() { |
| 1588 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1593 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
| 1589 } | 1594 } |
| 1590 | 1595 |
| 1591 } // namespace content | 1596 } // namespace content |
| OLD | NEW |