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 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 | 1081 |
1084 // Our base class RenderWidgetHost needs to reset some stuff. | 1082 // Our base class RenderWidgetHost needs to reset some stuff. |
1085 RendererExited(render_view_termination_status_, exit_code); | 1083 RendererExited(render_view_termination_status_, exit_code); |
1086 | 1084 |
1087 delegate_->RenderViewTerminated(this, | 1085 delegate_->RenderViewTerminated(this, |
1088 static_cast<base::TerminationStatus>(status), | 1086 static_cast<base::TerminationStatus>(status), |
1089 exit_code); | 1087 exit_code); |
1090 } | 1088 } |
1091 | 1089 |
1092 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { | 1090 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 | 1091 // Without this check, the renderer can trick the browser into using |
1101 // filenames it can't access in a future session restore. | 1092 // filenames it can't access in a future session restore. |
1102 if (!CanAccessFilesOfPageState(state)) { | 1093 if (!CanAccessFilesOfPageState(state)) { |
1103 GetProcess()->ReceivedBadMessage(); | 1094 GetProcess()->ReceivedBadMessage(); |
1104 return; | 1095 return; |
1105 } | 1096 } |
1106 | 1097 |
1107 delegate_->UpdateState(this, page_id_, state); | 1098 delegate_->UpdateState(this, page_id, state); |
1108 } | 1099 } |
1109 | 1100 |
1110 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { | 1101 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_)) | 1102 if (IsRVHStateActive(rvh_state_)) |
1118 delegate_->UpdateTargetURL(page_id_, url); | 1103 delegate_->UpdateTargetURL(page_id, url); |
1119 | 1104 |
1120 // Send a notification back to the renderer that we are ready to | 1105 // Send a notification back to the renderer that we are ready to |
1121 // receive more target urls. | 1106 // receive more target urls. |
1122 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); | 1107 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); |
1123 } | 1108 } |
1124 | 1109 |
1125 void RenderViewHostImpl::OnClose() { | 1110 void RenderViewHostImpl::OnClose() { |
1126 // If the renderer is telling us to close, it has already run the unload | 1111 // If the renderer is telling us to close, it has already run the unload |
1127 // events, and we can take the fast path. | 1112 // events, and we can take the fast path. |
1128 ClosePageIgnoringUnloadEvents(); | 1113 ClosePageIgnoringUnloadEvents(); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1512 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1528 | 1513 |
1529 frame_tree->ResetForMainFrameSwap(); | 1514 frame_tree->ResetForMainFrameSwap(); |
1530 } | 1515 } |
1531 | 1516 |
1532 void RenderViewHostImpl::SelectWordAroundCaret() { | 1517 void RenderViewHostImpl::SelectWordAroundCaret() { |
1533 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1518 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1534 } | 1519 } |
1535 | 1520 |
1536 } // namespace content | 1521 } // namespace content |
OLD | NEW |