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 tag, |
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, tag, |
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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 } | 701 } |
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(int tag, const gfx::Size& size) { |
711 const TransportDIB::Handle& dib_handle, const gfx::Size& size) { | |
712 if (painting_observer_) { | 712 if (painting_observer_) { |
713 painting_observer_->WidgetDidReceivePaintAtSizeAck(this, dib_handle, size); | 713 painting_observer_->WidgetDidReceivePaintAtSizeAck(this, tag, size); |
714 } | 714 } |
715 } | 715 } |
716 | 716 |
717 void RenderWidgetHost::OnMsgUpdateRect( | 717 void RenderWidgetHost::OnMsgUpdateRect( |
718 const ViewHostMsg_UpdateRect_Params& params) { | 718 const ViewHostMsg_UpdateRect_Params& params) { |
719 TimeTicks paint_start = TimeTicks::Now(); | 719 TimeTicks paint_start = TimeTicks::Now(); |
720 | 720 |
721 // Update our knowledge of the RenderWidget's size. | 721 // Update our knowledge of the RenderWidget's size. |
722 current_size_ = params.view_size; | 722 current_size_ = params.view_size; |
723 | 723 |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 // of this key event. | 1160 // of this key event. |
1161 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { | 1161 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { |
1162 UnhandledKeyboardEvent(front_item); | 1162 UnhandledKeyboardEvent(front_item); |
1163 | 1163 |
1164 // WARNING: This RenderWidgetHost can be deallocated at this point | 1164 // WARNING: This RenderWidgetHost can be deallocated at this point |
1165 // (i.e. in the case of Ctrl+W, where the call to | 1165 // (i.e. in the case of Ctrl+W, where the call to |
1166 // UnhandledKeyboardEvent destroys this RenderWidgetHost). | 1166 // UnhandledKeyboardEvent destroys this RenderWidgetHost). |
1167 } | 1167 } |
1168 } | 1168 } |
1169 } | 1169 } |
OLD | NEW |