| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // when we receive ViewMsg_Close. | 142 // when we receive ViewMsg_Close. |
| 143 AddRef(); | 143 AddRef(); |
| 144 } else { | 144 } else { |
| 145 DCHECK(false); | 145 DCHECK(false); |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 | 148 |
| 149 // This is used to complete pending inits and non-pending inits. For non- | 149 // This is used to complete pending inits and non-pending inits. For non- |
| 150 // pending cases, the parent will be the same as the current parent. This | 150 // pending cases, the parent will be the same as the current parent. This |
| 151 // indicates we do not need to reparent or anything. | 151 // indicates we do not need to reparent or anything. |
| 152 void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd) { | 152 void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd, |
| 153 gfx::PluginWindowHandle compositing_surface) { |
| 153 DCHECK(routing_id_ != MSG_ROUTING_NONE); | 154 DCHECK(routing_id_ != MSG_ROUTING_NONE); |
| 154 | 155 |
| 155 host_window_ = parent_hwnd; | 156 host_window_ = parent_hwnd; |
| 157 compositing_surface_ = compositing_surface; |
| 156 | 158 |
| 157 Send(new ViewHostMsg_RenderViewReady(routing_id_)); | 159 Send(new ViewHostMsg_RenderViewReady(routing_id_)); |
| 158 } | 160 } |
| 159 | 161 |
| 160 bool RenderWidget::OnMessageReceived(const IPC::Message& message) { | 162 bool RenderWidget::OnMessageReceived(const IPC::Message& message) { |
| 161 bool handled = true; | 163 bool handled = true; |
| 162 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) | 164 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) |
| 163 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 165 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
| 164 IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) | 166 IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) |
| 165 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) | 167 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 190 | 192 |
| 191 // If given a messsage without a routing ID, then assign our routing ID. | 193 // If given a messsage without a routing ID, then assign our routing ID. |
| 192 if (message->routing_id() == MSG_ROUTING_NONE) | 194 if (message->routing_id() == MSG_ROUTING_NONE) |
| 193 message->set_routing_id(routing_id_); | 195 message->set_routing_id(routing_id_); |
| 194 | 196 |
| 195 return render_thread_->Send(message); | 197 return render_thread_->Send(message); |
| 196 } | 198 } |
| 197 | 199 |
| 198 // Got a response from the browser after the renderer decided to create a new | 200 // Got a response from the browser after the renderer decided to create a new |
| 199 // view. | 201 // view. |
| 200 void RenderWidget::OnCreatingNewAck(gfx::NativeViewId parent) { | 202 void RenderWidget::OnCreatingNewAck( |
| 203 gfx::NativeViewId parent, |
| 204 gfx::PluginWindowHandle compositing_surface) { |
| 201 DCHECK(routing_id_ != MSG_ROUTING_NONE); | 205 DCHECK(routing_id_ != MSG_ROUTING_NONE); |
| 202 | 206 |
| 203 CompleteInit(parent); | 207 CompleteInit(parent, compositing_surface); |
| 204 } | 208 } |
| 205 | 209 |
| 206 void RenderWidget::OnClose() { | 210 void RenderWidget::OnClose() { |
| 207 if (closing_) | 211 if (closing_) |
| 208 return; | 212 return; |
| 209 closing_ = true; | 213 closing_ = true; |
| 210 | 214 |
| 211 // Browser correspondence is no longer needed at this point. | 215 // Browser correspondence is no longer needed at this point. |
| 212 if (routing_id_ != MSG_ROUTING_NONE) { | 216 if (routing_id_ != MSG_ROUTING_NONE) { |
| 213 render_thread_->RemoveRoute(routing_id_); | 217 render_thread_->RemoveRoute(routing_id_); |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 | 1113 |
| 1110 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { | 1114 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { |
| 1111 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); | 1115 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); |
| 1112 i != plugin_window_moves_.end(); ++i) { | 1116 i != plugin_window_moves_.end(); ++i) { |
| 1113 if (i->window == window) { | 1117 if (i->window == window) { |
| 1114 plugin_window_moves_.erase(i); | 1118 plugin_window_moves_.erase(i); |
| 1115 break; | 1119 break; |
| 1116 } | 1120 } |
| 1117 } | 1121 } |
| 1118 } | 1122 } |
| OLD | NEW |