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/renderer/render_widget.h" | 5 #include "chrome/renderer/render_widget.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/gfx/point.h" | 9 #include "base/gfx/point.h" |
10 #include "base/gfx/size.h" | 10 #include "base/gfx/size.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // when we receive ViewMsg_Close. | 136 // when we receive ViewMsg_Close. |
137 AddRef(); | 137 AddRef(); |
138 } else { | 138 } else { |
139 DCHECK(false); | 139 DCHECK(false); |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 // This is used to complete pending inits and non-pending inits. For non- | 143 // This is used to complete pending inits and non-pending inits. For non- |
144 // pending cases, the parent will be the same as the current parent. This | 144 // pending cases, the parent will be the same as the current parent. This |
145 // indicates we do not need to reparent or anything. | 145 // indicates we do not need to reparent or anything. |
146 void RenderWidget::CompleteInit(HWND parent_hwnd) { | 146 void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd) { |
147 DCHECK(routing_id_ != MSG_ROUTING_NONE); | 147 DCHECK(routing_id_ != MSG_ROUTING_NONE); |
148 DCHECK(parent_hwnd); | |
149 | 148 |
150 host_window_ = parent_hwnd; | 149 host_window_ = parent_hwnd; |
151 | 150 |
152 Send(new ViewHostMsg_RendererReady(routing_id_)); | 151 Send(new ViewHostMsg_RendererReady(routing_id_)); |
153 } | 152 } |
154 | 153 |
155 IPC_DEFINE_MESSAGE_MAP(RenderWidget) | 154 IPC_DEFINE_MESSAGE_MAP(RenderWidget) |
156 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 155 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
157 IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) | 156 IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) |
158 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) | 157 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 189 |
191 return rv; | 190 return rv; |
192 } | 191 } |
193 | 192 |
194 bool RenderWidget::InSend() const { | 193 bool RenderWidget::InSend() const { |
195 return render_thread_->InSend(); | 194 return render_thread_->InSend(); |
196 } | 195 } |
197 | 196 |
198 // Got a response from the browser after the renderer decided to create a new | 197 // Got a response from the browser after the renderer decided to create a new |
199 // view. | 198 // view. |
200 void RenderWidget::OnCreatingNewAck(HWND parent) { | 199 void RenderWidget::OnCreatingNewAck(gfx::NativeViewId parent) { |
201 DCHECK(routing_id_ != MSG_ROUTING_NONE); | 200 DCHECK(routing_id_ != MSG_ROUTING_NONE); |
202 | 201 |
203 CompleteInit(parent); | 202 CompleteInit(parent); |
204 } | 203 } |
205 | 204 |
206 void RenderWidget::OnClose() { | 205 void RenderWidget::OnClose() { |
207 if (closing_) | 206 if (closing_) |
208 return; | 207 return; |
209 closing_ = true; | 208 closing_ = true; |
210 | 209 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 scroll_rect_ = gfx::Rect(); | 495 scroll_rect_ = gfx::Rect(); |
497 | 496 |
498 PaintRect(damaged_rect, current_scroll_buf_); | 497 PaintRect(damaged_rect, current_scroll_buf_); |
499 Send(new ViewHostMsg_ScrollRect(routing_id_, params)); | 498 Send(new ViewHostMsg_ScrollRect(routing_id_, params)); |
500 UpdateIME(); | 499 UpdateIME(); |
501 } | 500 } |
502 | 501 |
503 /////////////////////////////////////////////////////////////////////////////// | 502 /////////////////////////////////////////////////////////////////////////////// |
504 // WebWidgetDelegate | 503 // WebWidgetDelegate |
505 | 504 |
506 gfx::NativeView RenderWidget::GetContainingView(WebWidget* webwidget) { | 505 gfx::NativeViewId RenderWidget::GetContainingView(WebWidget* webwidget) { |
507 return host_window_; | 506 return host_window_; |
508 } | 507 } |
509 | 508 |
510 void RenderWidget::DidInvalidateRect(WebWidget* webwidget, | 509 void RenderWidget::DidInvalidateRect(WebWidget* webwidget, |
511 const gfx::Rect& rect) { | 510 const gfx::Rect& rect) { |
512 // We only want one pending DoDeferredPaint call at any time... | 511 // We only want one pending DoDeferredPaint call at any time... |
513 bool paint_pending = !paint_rect_.IsEmpty(); | 512 bool paint_pending = !paint_rect_.IsEmpty(); |
514 | 513 |
515 // If this invalidate overlaps with a pending scroll, then we have to | 514 // If this invalidate overlaps with a pending scroll, then we have to |
516 // downgrade to invalidating the scroll rect. | 515 // downgrade to invalidating the scroll rect. |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 for (; i < plugin_window_moves_.size(); ++i) { | 768 for (; i < plugin_window_moves_.size(); ++i) { |
770 if (plugin_window_moves_[i].window == move.window) { | 769 if (plugin_window_moves_[i].window == move.window) { |
771 plugin_window_moves_[i] = move; | 770 plugin_window_moves_[i] = move; |
772 break; | 771 break; |
773 } | 772 } |
774 } | 773 } |
775 | 774 |
776 if (i == plugin_window_moves_.size()) | 775 if (i == plugin_window_moves_.size()) |
777 plugin_window_moves_.push_back(move); | 776 plugin_window_moves_.push_back(move); |
778 } | 777 } |
OLD | NEW |