| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_widget_host.h" | 5 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 6 | 6 |
| 7 #include "app/keyboard_codes.h" | 7 #include "app/keyboard_codes.h" |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 DCHECK(rv); | 144 DCHECK(rv); |
| 145 } | 145 } |
| 146 | 146 |
| 147 Destroy(); | 147 Destroy(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 bool RenderWidgetHost::IsRenderView() const { | 150 bool RenderWidgetHost::IsRenderView() const { |
| 151 return false; | 151 return false; |
| 152 } | 152 } |
| 153 | 153 |
| 154 void RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) { | 154 bool RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) { |
| 155 bool handled = true; |
| 155 bool msg_is_ok = true; | 156 bool msg_is_ok = true; |
| 156 IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHost, msg, msg_is_ok) | 157 IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHost, msg, msg_is_ok) |
| 157 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) | 158 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) |
| 158 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) | 159 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) |
| 159 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) | 160 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) |
| 160 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) | 161 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) |
| 161 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) | 162 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) |
| 162 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) | 163 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) |
| 163 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) | 164 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) |
| 164 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) | 165 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 185 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetTransportDIB, | 186 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetTransportDIB, |
| 186 OnAcceleratedSurfaceSetTransportDIB) | 187 OnAcceleratedSurfaceSetTransportDIB) |
| 187 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceBuffersSwapped, | 188 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceBuffersSwapped, |
| 188 OnAcceleratedSurfaceBuffersSwapped) | 189 OnAcceleratedSurfaceBuffersSwapped) |
| 189 #elif defined(OS_POSIX) | 190 #elif defined(OS_POSIX) |
| 190 IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer, | 191 IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer, |
| 191 OnMsgCreatePluginContainer) | 192 OnMsgCreatePluginContainer) |
| 192 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, | 193 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, |
| 193 OnMsgDestroyPluginContainer) | 194 OnMsgDestroyPluginContainer) |
| 194 #endif | 195 #endif |
| 195 IPC_MESSAGE_UNHANDLED_ERROR() | 196 IPC_MESSAGE_UNHANDLED(handled = false) |
| 196 IPC_END_MESSAGE_MAP_EX() | 197 IPC_END_MESSAGE_MAP_EX() |
| 197 | 198 |
| 198 if (!msg_is_ok) { | 199 if (!msg_is_ok) { |
| 199 // The message de-serialization failed. Kill the renderer process. | 200 // The message de-serialization failed. Kill the renderer process. |
| 200 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RWH")); | 201 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RWH")); |
| 201 process()->ReceivedBadMessage(); | 202 process()->ReceivedBadMessage(); |
| 202 } | 203 } |
| 204 return handled; |
| 203 } | 205 } |
| 204 | 206 |
| 205 bool RenderWidgetHost::Send(IPC::Message* msg) { | 207 bool RenderWidgetHost::Send(IPC::Message* msg) { |
| 206 return process_->Send(msg); | 208 return process_->Send(msg); |
| 207 } | 209 } |
| 208 | 210 |
| 209 void RenderWidgetHost::WasHidden() { | 211 void RenderWidgetHost::WasHidden() { |
| 210 is_hidden_ = true; | 212 is_hidden_ = true; |
| 211 | 213 |
| 212 // Don't bother reporting hung state when we aren't the active tab. | 214 // Don't bother reporting hung state when we aren't the active tab. |
| (...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 return; | 1250 return; |
| 1249 | 1251 |
| 1250 for (int i = 0; i < static_cast<int>(deferred_plugin_handles_.size()); i++) { | 1252 for (int i = 0; i < static_cast<int>(deferred_plugin_handles_.size()); i++) { |
| 1251 #if defined(TOOLKIT_USES_GTK) | 1253 #if defined(TOOLKIT_USES_GTK) |
| 1252 view_->CreatePluginContainer(deferred_plugin_handles_[i]); | 1254 view_->CreatePluginContainer(deferred_plugin_handles_[i]); |
| 1253 #endif | 1255 #endif |
| 1254 } | 1256 } |
| 1255 | 1257 |
| 1256 deferred_plugin_handles_.clear(); | 1258 deferred_plugin_handles_.clear(); |
| 1257 } | 1259 } |
| OLD | NEW |