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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 bool hidden) | 179 bool hidden) |
182 : RenderWidgetHostImpl(widget_delegate, | 180 : RenderWidgetHostImpl(widget_delegate, |
183 instance->GetProcess(), | 181 instance->GetProcess(), |
184 routing_id, | 182 routing_id, |
185 hidden), | 183 hidden), |
186 frames_ref_count_(0), | 184 frames_ref_count_(0), |
187 delegate_(delegate), | 185 delegate_(delegate), |
188 instance_(static_cast<SiteInstanceImpl*>(instance)), | 186 instance_(static_cast<SiteInstanceImpl*>(instance)), |
189 waiting_for_drag_context_response_(false), | 187 waiting_for_drag_context_response_(false), |
190 enabled_bindings_(0), | 188 enabled_bindings_(0), |
191 page_id_(-1), | |
192 main_frame_routing_id_(main_frame_routing_id), | 189 main_frame_routing_id_(main_frame_routing_id), |
193 run_modal_reply_msg_(NULL), | 190 run_modal_reply_msg_(NULL), |
194 run_modal_opener_id_(MSG_ROUTING_NONE), | 191 run_modal_opener_id_(MSG_ROUTING_NONE), |
195 is_waiting_for_beforeunload_ack_(false), | 192 is_waiting_for_beforeunload_ack_(false), |
196 unload_ack_is_for_cross_site_transition_(false), | 193 unload_ack_is_for_cross_site_transition_(false), |
197 sudden_termination_allowed_(false), | 194 sudden_termination_allowed_(false), |
198 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 195 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
199 virtual_keyboard_requested_(false), | 196 virtual_keyboard_requested_(false), |
200 weak_factory_(this), | 197 weak_factory_(this), |
201 is_focused_element_editable_(false), | 198 is_focused_element_editable_(false), |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 | 1045 |
1049 // Our base class RenderWidgetHost needs to reset some stuff. | 1046 // Our base class RenderWidgetHost needs to reset some stuff. |
1050 RendererExited(render_view_termination_status_, exit_code); | 1047 RendererExited(render_view_termination_status_, exit_code); |
1051 | 1048 |
1052 delegate_->RenderViewTerminated(this, | 1049 delegate_->RenderViewTerminated(this, |
1053 static_cast<base::TerminationStatus>(status), | 1050 static_cast<base::TerminationStatus>(status), |
1054 exit_code); | 1051 exit_code); |
1055 } | 1052 } |
1056 | 1053 |
1057 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { | 1054 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { |
1058 if (page_id_ != page_id) { | |
1059 base::debug::SetCrashKeyValue( | |
1060 "url1", GetMainFrame()->GetLastCommittedURL().possibly_invalid_spec()); | |
1061 base::debug::SetCrashKeyValue("id1", base::IntToString(page_id_)); | |
1062 base::debug::SetCrashKeyValue("id2", base::IntToString(page_id)); | |
1063 CHECK(false); | |
1064 } | |
1065 // Without this check, the renderer can trick the browser into using | 1055 // Without this check, the renderer can trick the browser into using |
1066 // filenames it can't access in a future session restore. | 1056 // filenames it can't access in a future session restore. |
1067 if (!CanAccessFilesOfPageState(state)) { | 1057 if (!CanAccessFilesOfPageState(state)) { |
1068 GetProcess()->ReceivedBadMessage(); | 1058 GetProcess()->ReceivedBadMessage(); |
1069 return; | 1059 return; |
1070 } | 1060 } |
1071 | 1061 |
1072 delegate_->UpdateState(this, page_id_, state); | 1062 delegate_->UpdateState(this, page_id, state); |
1073 } | 1063 } |
1074 | 1064 |
1075 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { | 1065 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { |
1076 if (page_id_ != page_id) { | |
1077 base::debug::SetCrashKeyValue("url1", url.possibly_invalid_spec()); | |
1078 base::debug::SetCrashKeyValue("id1", base::IntToString(page_id_)); | |
1079 base::debug::SetCrashKeyValue("id2", base::IntToString(page_id)); | |
1080 CHECK(false); | |
1081 } | |
1082 if (IsRVHStateActive(rvh_state_)) | 1066 if (IsRVHStateActive(rvh_state_)) |
1083 delegate_->UpdateTargetURL(page_id_, url); | 1067 delegate_->UpdateTargetURL(page_id, url); |
1084 | 1068 |
1085 // Send a notification back to the renderer that we are ready to | 1069 // Send a notification back to the renderer that we are ready to |
1086 // receive more target urls. | 1070 // receive more target urls. |
1087 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); | 1071 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); |
1088 } | 1072 } |
1089 | 1073 |
1090 void RenderViewHostImpl::OnUpdateInspectorSetting( | 1074 void RenderViewHostImpl::OnUpdateInspectorSetting( |
1091 const std::string& key, const std::string& value) { | 1075 const std::string& key, const std::string& value) { |
1092 GetContentClient()->browser()->UpdateInspectorSetting( | 1076 GetContentClient()->browser()->UpdateInspectorSetting( |
1093 this, key, value); | 1077 this, key, value); |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1532 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1549 | 1533 |
1550 frame_tree->ResetForMainFrameSwap(); | 1534 frame_tree->ResetForMainFrameSwap(); |
1551 } | 1535 } |
1552 | 1536 |
1553 void RenderViewHostImpl::SelectWordAroundCaret() { | 1537 void RenderViewHostImpl::SelectWordAroundCaret() { |
1554 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1538 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1555 } | 1539 } |
1556 | 1540 |
1557 } // namespace content | 1541 } // namespace content |
OLD | NEW |