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