| 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/renderer/render_widget.h" | 5 #include "chrome/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "app/surface/transport_dib.h" | 7 #include "app/surface/transport_dib.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // pending cases, the parent will be the same as the current parent. This | 146 // pending cases, the parent will be the same as the current parent. This |
| 147 // indicates we do not need to reparent or anything. | 147 // indicates we do not need to reparent or anything. |
| 148 void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd) { | 148 void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd) { |
| 149 DCHECK(routing_id_ != MSG_ROUTING_NONE); | 149 DCHECK(routing_id_ != MSG_ROUTING_NONE); |
| 150 | 150 |
| 151 host_window_ = parent_hwnd; | 151 host_window_ = parent_hwnd; |
| 152 | 152 |
| 153 Send(new ViewHostMsg_RenderViewReady(routing_id_)); | 153 Send(new ViewHostMsg_RenderViewReady(routing_id_)); |
| 154 } | 154 } |
| 155 | 155 |
| 156 IPC_DEFINE_MESSAGE_MAP(RenderWidget) | 156 bool RenderWidget::OnMessageReceived(const IPC::Message& message) { |
| 157 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 157 bool handled = true; |
| 158 IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) | 158 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) |
| 159 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) | 159 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
| 160 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) | 160 IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) |
| 161 IPC_MESSAGE_HANDLER(ViewMsg_WasRestored, OnWasRestored) | 161 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) |
| 162 IPC_MESSAGE_HANDLER(ViewMsg_UpdateRect_ACK, OnUpdateRectAck) | 162 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) |
| 163 IPC_MESSAGE_HANDLER(ViewMsg_HandleInputEvent, OnHandleInputEvent) | 163 IPC_MESSAGE_HANDLER(ViewMsg_WasRestored, OnWasRestored) |
| 164 IPC_MESSAGE_HANDLER(ViewMsg_MouseCaptureLost, OnMouseCaptureLost) | 164 IPC_MESSAGE_HANDLER(ViewMsg_UpdateRect_ACK, OnUpdateRectAck) |
| 165 IPC_MESSAGE_HANDLER(ViewMsg_SetFocus, OnSetFocus) | 165 IPC_MESSAGE_HANDLER(ViewMsg_HandleInputEvent, OnHandleInputEvent) |
| 166 IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive) | 166 IPC_MESSAGE_HANDLER(ViewMsg_MouseCaptureLost, OnMouseCaptureLost) |
| 167 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition) | 167 IPC_MESSAGE_HANDLER(ViewMsg_SetFocus, OnSetFocus) |
| 168 IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition) | 168 IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive) |
| 169 IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnMsgPaintAtSize) | 169 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition) |
| 170 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnMsgRepaint) | 170 IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition) |
| 171 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) | 171 IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnMsgPaintAtSize) |
| 172 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) | 172 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnMsgRepaint) |
| 173 IPC_MESSAGE_UNHANDLED_ERROR() | 173 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) |
| 174 IPC_END_MESSAGE_MAP() | 174 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) |
| 175 IPC_MESSAGE_UNHANDLED(handled = false) |
| 176 IPC_END_MESSAGE_MAP() |
| 177 return handled; |
| 178 } |
| 175 | 179 |
| 176 bool RenderWidget::Send(IPC::Message* message) { | 180 bool RenderWidget::Send(IPC::Message* message) { |
| 177 // Don't send any messages after the browser has told us to close. | 181 // Don't send any messages after the browser has told us to close. |
| 178 if (closing_) { | 182 if (closing_) { |
| 179 delete message; | 183 delete message; |
| 180 return false; | 184 return false; |
| 181 } | 185 } |
| 182 | 186 |
| 183 // If given a messsage without a routing ID, then assign our routing ID. | 187 // If given a messsage without a routing ID, then assign our routing ID. |
| 184 if (message->routing_id() == MSG_ROUTING_NONE) | 188 if (message->routing_id() == MSG_ROUTING_NONE) |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 | 1021 |
| 1018 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { | 1022 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { |
| 1019 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); | 1023 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); |
| 1020 i != plugin_window_moves_.end(); ++i) { | 1024 i != plugin_window_moves_.end(); ++i) { |
| 1021 if (i->window == window) { | 1025 if (i->window == window) { |
| 1022 plugin_window_moves_.erase(i); | 1026 plugin_window_moves_.erase(i); |
| 1023 break; | 1027 break; |
| 1024 } | 1028 } |
| 1025 } | 1029 } |
| 1026 } | 1030 } |
| OLD | NEW |