| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_view_host.h" | 5 #include "chrome/browser/renderer_host/render_view_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gfx/native_widget_types.h" | 10 #include "base/gfx/native_widget_types.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 debugger_attached_(false), | 90 debugger_attached_(false), |
| 91 enable_dom_ui_bindings_(false), | 91 enable_dom_ui_bindings_(false), |
| 92 pending_request_id_(0), | 92 pending_request_id_(0), |
| 93 enable_external_host_bindings_(false), | 93 enable_external_host_bindings_(false), |
| 94 modal_dialog_count_(0), | 94 modal_dialog_count_(0), |
| 95 navigations_suspended_(false), | 95 navigations_suspended_(false), |
| 96 suspended_nav_message_(NULL), | 96 suspended_nav_message_(NULL), |
| 97 run_modal_reply_msg_(NULL), | 97 run_modal_reply_msg_(NULL), |
| 98 has_unload_listener_(false), | 98 has_unload_listener_(false), |
| 99 is_waiting_for_unload_ack_(false), | 99 is_waiting_for_unload_ack_(false), |
| 100 are_javascript_messages_suppressed_(false) { | 100 are_javascript_messages_suppressed_(false), |
| 101 inspected_process_id_(-1), |
| 102 inspected_view_id_(-1) { |
| 101 DCHECK(instance_); | 103 DCHECK(instance_); |
| 102 DCHECK(delegate_); | 104 DCHECK(delegate_); |
| 103 if (modal_dialog_event == NULL) | 105 if (modal_dialog_event == NULL) |
| 104 modal_dialog_event = new base::WaitableEvent(true, false); | 106 modal_dialog_event = new base::WaitableEvent(true, false); |
| 105 | 107 |
| 106 modal_dialog_event_.reset(modal_dialog_event); | 108 modal_dialog_event_.reset(modal_dialog_event); |
| 107 #ifdef CHROME_PERSONALIZATION | 109 #ifdef CHROME_PERSONALIZATION |
| 108 personalization_ = Personalization::CreateHostPersonalization(this); | 110 personalization_ = Personalization::CreateHostPersonalization(this); |
| 109 #endif | 111 #endif |
| 110 } | 112 } |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 IPC_MESSAGE_HANDLER(ViewHostMsg_PageHasOSDD, OnMsgPageHasOSDD) | 728 IPC_MESSAGE_HANDLER(ViewHostMsg_PageHasOSDD, OnMsgPageHasOSDD) |
| 727 IPC_MESSAGE_HANDLER(ViewHostMsg_InspectElement_Reply, | 729 IPC_MESSAGE_HANDLER(ViewHostMsg_InspectElement_Reply, |
| 728 OnMsgInspectElementReply) | 730 OnMsgInspectElementReply) |
| 729 IPC_MESSAGE_FORWARD(ViewHostMsg_DidGetPrintedPagesCount, | 731 IPC_MESSAGE_FORWARD(ViewHostMsg_DidGetPrintedPagesCount, |
| 730 delegate_, | 732 delegate_, |
| 731 RenderViewHostDelegate::DidGetPrintedPagesCount) | 733 RenderViewHostDelegate::DidGetPrintedPagesCount) |
| 732 IPC_MESSAGE_HANDLER(ViewHostMsg_DidPrintPage, DidPrintPage) | 734 IPC_MESSAGE_HANDLER(ViewHostMsg_DidPrintPage, DidPrintPage) |
| 733 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) | 735 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) |
| 734 IPC_MESSAGE_HANDLER(ViewHostMsg_DebuggerOutput, OnDebuggerOutput); | 736 IPC_MESSAGE_HANDLER(ViewHostMsg_DebuggerOutput, OnDebuggerOutput); |
| 735 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDebugAttach, DidDebugAttach); | 737 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDebugAttach, DidDebugAttach); |
| 738 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsAgent, |
| 739 OnForwardToDevToolsAgent); |
| 740 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsClient, |
| 741 OnForwardToDevToolsClient); |
| 736 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, | 742 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, |
| 737 OnUserMetricsRecordAction) | 743 OnUserMetricsRecordAction) |
| 738 IPC_MESSAGE_HANDLER(ViewHostMsg_MissingPluginStatus, OnMissingPluginStatus); | 744 IPC_MESSAGE_HANDLER(ViewHostMsg_MissingPluginStatus, OnMissingPluginStatus); |
| 739 IPC_MESSAGE_FORWARD(ViewHostMsg_CrashedPlugin, delegate_, | 745 IPC_MESSAGE_FORWARD(ViewHostMsg_CrashedPlugin, delegate_, |
| 740 RenderViewHostDelegate::OnCrashedPlugin); | 746 RenderViewHostDelegate::OnCrashedPlugin); |
| 741 IPC_MESSAGE_HANDLER(ViewHostMsg_SendCurrentPageAllSavableResourceLinks, | 747 IPC_MESSAGE_HANDLER(ViewHostMsg_SendCurrentPageAllSavableResourceLinks, |
| 742 OnReceivedSavableResourceLinksForCurrentPage); | 748 OnReceivedSavableResourceLinksForCurrentPage); |
| 743 IPC_MESSAGE_HANDLER(ViewHostMsg_SendSerializedHtmlData, | 749 IPC_MESSAGE_HANDLER(ViewHostMsg_SendSerializedHtmlData, |
| 744 OnReceivedSerializedHtmlData); | 750 OnReceivedSerializedHtmlData); |
| 745 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, | 751 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 g_browser_process->debugger_wrapper()->DebugMessage(output); | 1167 g_browser_process->debugger_wrapper()->DebugMessage(output); |
| 1162 } | 1168 } |
| 1163 | 1169 |
| 1164 void RenderViewHost::DidDebugAttach() { | 1170 void RenderViewHost::DidDebugAttach() { |
| 1165 if (!debugger_attached_) { | 1171 if (!debugger_attached_) { |
| 1166 debugger_attached_ = true; | 1172 debugger_attached_ = true; |
| 1167 g_browser_process->debugger_wrapper()->OnDebugAttach(); | 1173 g_browser_process->debugger_wrapper()->OnDebugAttach(); |
| 1168 } | 1174 } |
| 1169 } | 1175 } |
| 1170 | 1176 |
| 1177 void RenderViewHost::SetInspectedView(int inspected_process_id, |
| 1178 int inspected_view_id) { |
| 1179 inspected_process_id_ = inspected_process_id; |
| 1180 inspected_view_id_ = inspected_view_id; |
| 1181 } |
| 1182 |
| 1183 void RenderViewHost::OnForwardToDevToolsAgent(const IPC::Message& message) { |
| 1184 RenderViewHost* host = RenderViewHost::FromID(inspected_process_id_, |
| 1185 inspected_view_id_); |
| 1186 if (!host) |
| 1187 return; |
| 1188 IPC::Message* m = new IPC::Message(message); |
| 1189 m->set_routing_id(inspected_view_id_); |
| 1190 host->Send(m); |
| 1191 } |
| 1192 |
| 1193 void RenderViewHost::OnForwardToDevToolsClient(const IPC::Message& message) { |
| 1194 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
| 1195 if (view) |
| 1196 view->ForwardMessageToDevToolsClient(message); |
| 1197 } |
| 1198 |
| 1171 void RenderViewHost::OnUserMetricsRecordAction(const std::wstring& action) { | 1199 void RenderViewHost::OnUserMetricsRecordAction(const std::wstring& action) { |
| 1172 UserMetrics::RecordComputedAction(action.c_str(), process()->profile()); | 1200 UserMetrics::RecordComputedAction(action.c_str(), process()->profile()); |
| 1173 } | 1201 } |
| 1174 | 1202 |
| 1175 void RenderViewHost::UnhandledInputEvent(const WebInputEvent& event) { | 1203 void RenderViewHost::UnhandledInputEvent(const WebInputEvent& event) { |
| 1176 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1204 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
| 1177 if (view) { | 1205 if (view) { |
| 1178 // TODO(brettw) why do we have to filter these types of events here. Can't | 1206 // TODO(brettw) why do we have to filter these types of events here. Can't |
| 1179 // the renderer just send us the ones we care abount, or maybe the view | 1207 // the renderer just send us the ones we care abount, or maybe the view |
| 1180 // should be able to decide which ones it wants or not? | 1208 // should be able to decide which ones it wants or not? |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 std::string event_arg) { | 1326 std::string event_arg) { |
| 1299 Send(new ViewMsg_PersonalizationEvent(routing_id(), event_name, event_arg)); | 1327 Send(new ViewMsg_PersonalizationEvent(routing_id(), event_name, event_arg)); |
| 1300 } | 1328 } |
| 1301 #endif | 1329 #endif |
| 1302 | 1330 |
| 1303 void RenderViewHost::ForwardMessageFromExternalHost( | 1331 void RenderViewHost::ForwardMessageFromExternalHost( |
| 1304 const std::string& target, const std::string& message) { | 1332 const std::string& target, const std::string& message) { |
| 1305 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), target, | 1333 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), target, |
| 1306 message)); | 1334 message)); |
| 1307 } | 1335 } |
| OLD | NEW |