Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(519)

Side by Side Diff: chrome/browser/renderer_host/render_widget_host.cc

Issue 661237: This adds in the ability for Chrome to generate windows with snapshots of all... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/histogram.h" 8 #include "base/histogram.h"
9 #include "base/keyboard_codes.h" 9 #include "base/keyboard_codes.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 Destroy(); 120 Destroy();
121 } 121 }
122 122
123 void RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) { 123 void RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) {
124 bool msg_is_ok = true; 124 bool msg_is_ok = true;
125 IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHost, msg, msg_is_ok) 125 IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHost, msg, msg_is_ok)
126 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) 126 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady)
127 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) 127 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone)
128 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) 128 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose)
129 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) 129 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove)
130 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck)
130 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) 131 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect)
131 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateVideo, OnMsgCreateVideo) 132 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateVideo, OnMsgCreateVideo)
132 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateVideo, OnMsgUpdateVideo) 133 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateVideo, OnMsgUpdateVideo)
133 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyVideo, OnMsgDestroyVideo) 134 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyVideo, OnMsgDestroyVideo)
134 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) 135 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck)
135 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) 136 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus)
136 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) 137 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur)
137 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnMsgFocusedNodeChanged) 138 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnMsgFocusedNodeChanged)
138 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) 139 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor)
139 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeUpdateStatus, OnMsgImeUpdateStatus) 140 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeUpdateStatus, OnMsgImeUpdateStatus)
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 view_ = NULL; 274 view_ = NULL;
274 } 275 }
275 276
276 void RenderWidgetHost::SetIsLoading(bool is_loading) { 277 void RenderWidgetHost::SetIsLoading(bool is_loading) {
277 is_loading_ = is_loading; 278 is_loading_ = is_loading;
278 if (!view_) 279 if (!view_)
279 return; 280 return;
280 view_->SetIsLoading(is_loading); 281 view_->SetIsLoading(is_loading);
281 } 282 }
282 283
284 void RenderWidgetHost::PaintAtSize(TransportDIB::Handle dib_handle,
285 const gfx::Size& size) {
286 // Ask the renderer to create a bitmap regardless of whether it's
287 // hidden, being resized, redrawn, etc., and to scale it by the
288 // scale factor given.
289 Send(new ViewMsg_PaintAtSize(routing_id_, dib_handle, size));
290 }
291
283 BackingStore* RenderWidgetHost::GetBackingStore(bool force_create) { 292 BackingStore* RenderWidgetHost::GetBackingStore(bool force_create) {
284 // We should not be asked to paint while we are hidden. If we are hidden, 293 // We should not be asked to paint while we are hidden. If we are hidden,
285 // then it means that our consumer failed to call WasRestored. If we're not 294 // then it means that our consumer failed to call WasRestored. If we're not
286 // force creating the backing store, it's OK since we can feel free to give 295 // force creating the backing store, it's OK since we can feel free to give
287 // out our cached one if we have it. 296 // out our cached one if we have it.
288 DCHECK(!is_hidden_ || !force_create) << 297 DCHECK(!is_hidden_ || !force_create) <<
289 "GetBackingStore called while hidden!"; 298 "GetBackingStore called while hidden!";
290 299
291 // We should never be called recursively; this can theoretically lead to 300 // We should never be called recursively; this can theoretically lead to
292 // infinite recursion and almost certainly leads to lower performance. 301 // infinite recursion and almost certainly leads to lower performance.
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 } 678 }
670 679
671 void RenderWidgetHost::OnMsgRequestMove(const gfx::Rect& pos) { 680 void RenderWidgetHost::OnMsgRequestMove(const gfx::Rect& pos) {
672 // Note that we ignore the position. 681 // Note that we ignore the position.
673 if (view_) { 682 if (view_) {
674 view_->SetSize(pos.size()); 683 view_->SetSize(pos.size());
675 Send(new ViewMsg_Move_ACK(routing_id_)); 684 Send(new ViewMsg_Move_ACK(routing_id_));
676 } 685 }
677 } 686 }
678 687
688 void RenderWidgetHost::OnMsgPaintAtSizeAck(
689 const TransportDIB::Handle& dib_handle, const gfx::Size& size) {
690 if (painting_observer_) {
691 painting_observer_->WidgetDidReceivePaintAtSizeAck(this, dib_handle, size);
692 }
693 }
694
679 void RenderWidgetHost::OnMsgUpdateRect( 695 void RenderWidgetHost::OnMsgUpdateRect(
680 const ViewHostMsg_UpdateRect_Params& params) { 696 const ViewHostMsg_UpdateRect_Params& params) {
681 TimeTicks paint_start = TimeTicks::Now(); 697 TimeTicks paint_start = TimeTicks::Now();
682 698
683 // Update our knowledge of the RenderWidget's size. 699 // Update our knowledge of the RenderWidget's size.
684 current_size_ = params.view_size; 700 current_size_ = params.view_size;
685 701
686 bool is_resize_ack = 702 bool is_resize_ack =
687 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); 703 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags);
688 704
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 // of this key event. 1090 // of this key event.
1075 if (!processed && !is_hidden_ && !front_item.skip_in_browser) { 1091 if (!processed && !is_hidden_ && !front_item.skip_in_browser) {
1076 UnhandledKeyboardEvent(front_item); 1092 UnhandledKeyboardEvent(front_item);
1077 1093
1078 // WARNING: This RenderWidgetHost can be deallocated at this point 1094 // WARNING: This RenderWidgetHost can be deallocated at this point
1079 // (i.e. in the case of Ctrl+W, where the call to 1095 // (i.e. in the case of Ctrl+W, where the call to
1080 // UnhandledKeyboardEvent destroys this RenderWidgetHost). 1096 // UnhandledKeyboardEvent destroys this RenderWidgetHost).
1081 } 1097 }
1082 } 1098 }
1083 } 1099 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host.h ('k') | chrome/browser/renderer_host/render_widget_host_painting_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698