| 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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
| 10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 291 } |
| 292 | 292 |
| 293 void RenderWidgetHost::SetIsLoading(bool is_loading) { | 293 void RenderWidgetHost::SetIsLoading(bool is_loading) { |
| 294 is_loading_ = is_loading; | 294 is_loading_ = is_loading; |
| 295 if (!view_) | 295 if (!view_) |
| 296 return; | 296 return; |
| 297 view_->SetIsLoading(is_loading); | 297 view_->SetIsLoading(is_loading); |
| 298 } | 298 } |
| 299 | 299 |
| 300 void RenderWidgetHost::PaintAtSize(TransportDIB::Handle dib_handle, | 300 void RenderWidgetHost::PaintAtSize(TransportDIB::Handle dib_handle, |
| 301 int sequence_id, |
| 301 const gfx::Size& page_size, | 302 const gfx::Size& page_size, |
| 302 const gfx::Size& desired_size) { | 303 const gfx::Size& desired_size) { |
| 303 // Ask the renderer to create a bitmap regardless of whether it's | 304 // Ask the renderer to create a bitmap regardless of whether it's |
| 304 // hidden, being resized, redrawn, etc. It resizes the web widget | 305 // hidden, being resized, redrawn, etc. It resizes the web widget |
| 305 // to the page_size and then scales it to the desired_size. | 306 // to the page_size and then scales it to the desired_size. |
| 306 Send(new ViewMsg_PaintAtSize(routing_id_, dib_handle, | 307 Send(new ViewMsg_PaintAtSize(routing_id_, dib_handle, sequence_id, |
| 307 page_size, desired_size)); | 308 page_size, desired_size)); |
| 308 } | 309 } |
| 309 | 310 |
| 310 BackingStore* RenderWidgetHost::GetBackingStore(bool force_create) { | 311 BackingStore* RenderWidgetHost::GetBackingStore(bool force_create) { |
| 311 // We should not be asked to paint while we are hidden. If we are hidden, | 312 // We should not be asked to paint while we are hidden. If we are hidden, |
| 312 // then it means that our consumer failed to call WasRestored. If we're not | 313 // then it means that our consumer failed to call WasRestored. If we're not |
| 313 // force creating the backing store, it's OK since we can feel free to give | 314 // force creating the backing store, it's OK since we can feel free to give |
| 314 // out our cached one if we have it. | 315 // out our cached one if we have it. |
| 315 DCHECK(!is_hidden_ || !force_create) << | 316 DCHECK(!is_hidden_ || !force_create) << |
| 316 "GetBackingStore called while hidden!"; | 317 "GetBackingStore called while hidden!"; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 | 702 |
| 702 void RenderWidgetHost::OnMsgRequestMove(const gfx::Rect& pos) { | 703 void RenderWidgetHost::OnMsgRequestMove(const gfx::Rect& pos) { |
| 703 // Note that we ignore the position. | 704 // Note that we ignore the position. |
| 704 if (view_) { | 705 if (view_) { |
| 705 view_->SetSize(pos.size()); | 706 view_->SetSize(pos.size()); |
| 706 Send(new ViewMsg_Move_ACK(routing_id_)); | 707 Send(new ViewMsg_Move_ACK(routing_id_)); |
| 707 } | 708 } |
| 708 } | 709 } |
| 709 | 710 |
| 710 void RenderWidgetHost::OnMsgPaintAtSizeAck( | 711 void RenderWidgetHost::OnMsgPaintAtSizeAck( |
| 711 const TransportDIB::Handle& dib_handle, const gfx::Size& size) { | 712 int sequence_id, const gfx::Size& size) { |
| 713 fprintf(stderr, "received paint ack!\n"); |
| 712 if (painting_observer_) { | 714 if (painting_observer_) { |
| 713 painting_observer_->WidgetDidReceivePaintAtSizeAck(this, dib_handle, size); | 715 fprintf(stderr, "realying paint ack\n"); |
| 716 painting_observer_->WidgetDidReceivePaintAtSizeAck(this, sequence_id, size); |
| 714 } | 717 } |
| 715 } | 718 } |
| 716 | 719 |
| 717 void RenderWidgetHost::OnMsgUpdateRect( | 720 void RenderWidgetHost::OnMsgUpdateRect( |
| 718 const ViewHostMsg_UpdateRect_Params& params) { | 721 const ViewHostMsg_UpdateRect_Params& params) { |
| 719 TimeTicks paint_start = TimeTicks::Now(); | 722 TimeTicks paint_start = TimeTicks::Now(); |
| 720 | 723 |
| 721 // Update our knowledge of the RenderWidget's size. | 724 // Update our knowledge of the RenderWidget's size. |
| 722 current_size_ = params.view_size; | 725 current_size_ = params.view_size; |
| 723 | 726 |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 // of this key event. | 1163 // of this key event. |
| 1161 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { | 1164 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { |
| 1162 UnhandledKeyboardEvent(front_item); | 1165 UnhandledKeyboardEvent(front_item); |
| 1163 | 1166 |
| 1164 // WARNING: This RenderWidgetHost can be deallocated at this point | 1167 // WARNING: This RenderWidgetHost can be deallocated at this point |
| 1165 // (i.e. in the case of Ctrl+W, where the call to | 1168 // (i.e. in the case of Ctrl+W, where the call to |
| 1166 // UnhandledKeyboardEvent destroys this RenderWidgetHost). | 1169 // UnhandledKeyboardEvent destroys this RenderWidgetHost). |
| 1167 } | 1170 } |
| 1168 } | 1171 } |
| 1169 } | 1172 } |
| OLD | NEW |