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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 std::unique_ptr<RenderWidgetHostImpl> widget, | 248 std::unique_ptr<RenderWidgetHostImpl> widget, |
249 RenderViewHostDelegate* delegate, | 249 RenderViewHostDelegate* delegate, |
250 int32_t main_frame_routing_id, | 250 int32_t main_frame_routing_id, |
251 bool swapped_out, | 251 bool swapped_out, |
252 bool has_initialized_audio_host) | 252 bool has_initialized_audio_host) |
253 : render_widget_host_(std::move(widget)), | 253 : render_widget_host_(std::move(widget)), |
254 frames_ref_count_(0), | 254 frames_ref_count_(0), |
255 delegate_(delegate), | 255 delegate_(delegate), |
256 instance_(static_cast<SiteInstanceImpl*>(instance)), | 256 instance_(static_cast<SiteInstanceImpl*>(instance)), |
257 enabled_bindings_(0), | 257 enabled_bindings_(0), |
258 page_id_(-1), | |
259 is_active_(!swapped_out), | 258 is_active_(!swapped_out), |
260 is_swapped_out_(swapped_out), | 259 is_swapped_out_(swapped_out), |
261 main_frame_routing_id_(main_frame_routing_id), | 260 main_frame_routing_id_(main_frame_routing_id), |
262 is_waiting_for_close_ack_(false), | 261 is_waiting_for_close_ack_(false), |
263 sudden_termination_allowed_(false), | 262 sudden_termination_allowed_(false), |
264 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 263 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
265 is_focused_element_editable_(false), | 264 is_focused_element_editable_(false), |
266 updating_web_preferences_(false), | 265 updating_web_preferences_(false), |
267 render_view_ready_on_process_launch_(false), | 266 render_view_ready_on_process_launch_(false), |
268 weak_factory_(this) { | 267 weak_factory_(this) { |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 Send(new ViewMsg_Move_ACK(route_id)); | 934 Send(new ViewMsg_Move_ACK(route_id)); |
936 } | 935 } |
937 | 936 |
938 void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) { | 937 void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) { |
939 // Do nothing, otherwise RenderWidgetHostImpl will assume it is not a | 938 // Do nothing, otherwise RenderWidgetHostImpl will assume it is not a |
940 // RenderViewHostImpl and destroy itself. | 939 // RenderViewHostImpl and destroy itself. |
941 // TODO(nasko): Remove this hack once RenderViewHost and RenderWidgetHost are | 940 // TODO(nasko): Remove this hack once RenderViewHost and RenderWidgetHost are |
942 // decoupled. | 941 // decoupled. |
943 } | 942 } |
944 | 943 |
945 void RenderViewHostImpl::OnUpdateState(int32_t page_id, | 944 void RenderViewHostImpl::OnUpdateState(const PageState& state) { |
946 const PageState& state) { | |
947 // If the following DCHECK fails, you have encountered a tricky edge-case that | |
948 // has evaded reproduction for a very long time. Please report what you were | |
949 // doing on http://crbug.com/407376, whether or not you can reproduce the | |
950 // failure. | |
951 DCHECK_EQ(page_id, page_id_); | |
952 | |
953 // Without this check, the renderer can trick the browser into using | 945 // Without this check, the renderer can trick the browser into using |
954 // filenames it can't access in a future session restore. | 946 // filenames it can't access in a future session restore. |
955 auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); | 947 auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); |
956 int child_id = GetProcess()->GetID(); | 948 int child_id = GetProcess()->GetID(); |
957 if (!policy->CanReadAllFiles(child_id, state.GetReferencedFiles())) { | 949 if (!policy->CanReadAllFiles(child_id, state.GetReferencedFiles())) { |
958 bad_message::ReceivedBadMessage( | 950 bad_message::ReceivedBadMessage( |
959 GetProcess(), bad_message::RVH_CAN_ACCESS_FILES_OF_PAGE_STATE); | 951 GetProcess(), bad_message::RVH_CAN_ACCESS_FILES_OF_PAGE_STATE); |
960 return; | 952 return; |
961 } | 953 } |
962 | 954 |
963 delegate_->UpdateState(this, page_id, state); | 955 delegate_->UpdateState(this, state); |
964 } | 956 } |
965 | 957 |
966 void RenderViewHostImpl::OnUpdateTargetURL(const GURL& url) { | 958 void RenderViewHostImpl::OnUpdateTargetURL(const GURL& url) { |
967 if (is_active_) | 959 if (is_active_) |
968 delegate_->UpdateTargetURL(this, url); | 960 delegate_->UpdateTargetURL(this, url); |
969 | 961 |
970 // Send a notification back to the renderer that we are ready to | 962 // Send a notification back to the renderer that we are ready to |
971 // receive more target urls. | 963 // receive more target urls. |
972 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); | 964 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); |
973 } | 965 } |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 // Note: We are using the origin URL provided by the sender here. It may be | 1323 // Note: We are using the origin URL provided by the sender here. It may be |
1332 // different from the receiver's. | 1324 // different from the receiver's. |
1333 file_system_file.url = | 1325 file_system_file.url = |
1334 GURL(storage::GetIsolatedFileSystemRootURIString( | 1326 GURL(storage::GetIsolatedFileSystemRootURIString( |
1335 file_system_url.origin(), filesystem_id, std::string()) | 1327 file_system_url.origin(), filesystem_id, std::string()) |
1336 .append(register_name)); | 1328 .append(register_name)); |
1337 } | 1329 } |
1338 } | 1330 } |
1339 | 1331 |
1340 } // namespace content | 1332 } // namespace content |
OLD | NEW |