| 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> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/crash_logging.h" | |
| 15 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
| 16 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
| 17 #include "base/json/json_reader.h" | 16 #include "base/json/json_reader.h" |
| 18 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 19 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 20 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
| 21 #include "base/strings/string_number_conversions.h" | |
| 22 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/sys_info.h" | 22 #include "base/sys_info.h" |
| 25 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 26 #include "base/values.h" | 24 #include "base/values.h" |
| 27 #include "cc/base/switches.h" | 25 #include "cc/base/switches.h" |
| 28 #include "content/browser/child_process_security_policy_impl.h" | 26 #include "content/browser/child_process_security_policy_impl.h" |
| 29 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 27 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 30 #include "content/browser/frame_host/frame_tree.h" | 28 #include "content/browser/frame_host/frame_tree.h" |
| 31 #include "content/browser/gpu/compositor_util.h" | 29 #include "content/browser/gpu/compositor_util.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 bool hidden) | 177 bool hidden) |
| 180 : RenderWidgetHostImpl(widget_delegate, | 178 : RenderWidgetHostImpl(widget_delegate, |
| 181 instance->GetProcess(), | 179 instance->GetProcess(), |
| 182 routing_id, | 180 routing_id, |
| 183 hidden), | 181 hidden), |
| 184 frames_ref_count_(0), | 182 frames_ref_count_(0), |
| 185 delegate_(delegate), | 183 delegate_(delegate), |
| 186 instance_(static_cast<SiteInstanceImpl*>(instance)), | 184 instance_(static_cast<SiteInstanceImpl*>(instance)), |
| 187 waiting_for_drag_context_response_(false), | 185 waiting_for_drag_context_response_(false), |
| 188 enabled_bindings_(0), | 186 enabled_bindings_(0), |
| 189 page_id_(-1), | |
| 190 main_frame_routing_id_(main_frame_routing_id), | 187 main_frame_routing_id_(main_frame_routing_id), |
| 191 run_modal_reply_msg_(NULL), | 188 run_modal_reply_msg_(NULL), |
| 192 run_modal_opener_id_(MSG_ROUTING_NONE), | 189 run_modal_opener_id_(MSG_ROUTING_NONE), |
| 193 is_waiting_for_beforeunload_ack_(false), | 190 is_waiting_for_beforeunload_ack_(false), |
| 194 unload_ack_is_for_cross_site_transition_(false), | 191 unload_ack_is_for_cross_site_transition_(false), |
| 195 sudden_termination_allowed_(false), | 192 sudden_termination_allowed_(false), |
| 196 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 193 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 197 virtual_keyboard_requested_(false), | 194 virtual_keyboard_requested_(false), |
| 198 weak_factory_(this), | 195 weak_factory_(this), |
| 199 is_focused_element_editable_(false), | 196 is_focused_element_editable_(false), |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 | 1080 |
| 1084 // Our base class RenderWidgetHost needs to reset some stuff. | 1081 // Our base class RenderWidgetHost needs to reset some stuff. |
| 1085 RendererExited(render_view_termination_status_, exit_code); | 1082 RendererExited(render_view_termination_status_, exit_code); |
| 1086 | 1083 |
| 1087 delegate_->RenderViewTerminated(this, | 1084 delegate_->RenderViewTerminated(this, |
| 1088 static_cast<base::TerminationStatus>(status), | 1085 static_cast<base::TerminationStatus>(status), |
| 1089 exit_code); | 1086 exit_code); |
| 1090 } | 1087 } |
| 1091 | 1088 |
| 1092 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { | 1089 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { |
| 1093 if (page_id_ != page_id) { | |
| 1094 base::debug::SetCrashKeyValue( | |
| 1095 "url1", GetMainFrame()->GetLastCommittedURL().possibly_invalid_spec()); | |
| 1096 base::debug::SetCrashKeyValue("id1", base::IntToString(page_id_)); | |
| 1097 base::debug::SetCrashKeyValue("id2", base::IntToString(page_id)); | |
| 1098 CHECK(false); | |
| 1099 } | |
| 1100 // Without this check, the renderer can trick the browser into using | 1090 // Without this check, the renderer can trick the browser into using |
| 1101 // filenames it can't access in a future session restore. | 1091 // filenames it can't access in a future session restore. |
| 1102 if (!CanAccessFilesOfPageState(state)) { | 1092 if (!CanAccessFilesOfPageState(state)) { |
| 1103 GetProcess()->ReceivedBadMessage(); | 1093 GetProcess()->ReceivedBadMessage(); |
| 1104 return; | 1094 return; |
| 1105 } | 1095 } |
| 1106 | 1096 |
| 1107 delegate_->UpdateState(this, page_id_, state); | 1097 delegate_->UpdateState(this, page_id, state); |
| 1108 } | 1098 } |
| 1109 | 1099 |
| 1110 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { | 1100 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { |
| 1111 if (page_id_ != page_id) { | |
| 1112 base::debug::SetCrashKeyValue("url1", url.possibly_invalid_spec()); | |
| 1113 base::debug::SetCrashKeyValue("id1", base::IntToString(page_id_)); | |
| 1114 base::debug::SetCrashKeyValue("id2", base::IntToString(page_id)); | |
| 1115 CHECK(false); | |
| 1116 } | |
| 1117 if (IsRVHStateActive(rvh_state_)) | 1101 if (IsRVHStateActive(rvh_state_)) |
| 1118 delegate_->UpdateTargetURL(page_id_, url); | 1102 delegate_->UpdateTargetURL(page_id, url); |
| 1119 | 1103 |
| 1120 // Send a notification back to the renderer that we are ready to | 1104 // Send a notification back to the renderer that we are ready to |
| 1121 // receive more target urls. | 1105 // receive more target urls. |
| 1122 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); | 1106 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); |
| 1123 } | 1107 } |
| 1124 | 1108 |
| 1125 void RenderViewHostImpl::OnClose() { | 1109 void RenderViewHostImpl::OnClose() { |
| 1126 // If the renderer is telling us to close, it has already run the unload | 1110 // If the renderer is telling us to close, it has already run the unload |
| 1127 // events, and we can take the fast path. | 1111 // events, and we can take the fast path. |
| 1128 ClosePageIgnoringUnloadEvents(); | 1112 ClosePageIgnoringUnloadEvents(); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1511 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 1528 | 1512 |
| 1529 frame_tree->ResetForMainFrameSwap(); | 1513 frame_tree->ResetForMainFrameSwap(); |
| 1530 } | 1514 } |
| 1531 | 1515 |
| 1532 void RenderViewHostImpl::SelectWordAroundCaret() { | 1516 void RenderViewHostImpl::SelectWordAroundCaret() { |
| 1533 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1517 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
| 1534 } | 1518 } |
| 1535 | 1519 |
| 1536 } // namespace content | 1520 } // namespace content |
| OLD | NEW |