| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/histogram.h" | 7 #include "base/histogram.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/keyboard_codes.h" | 9 #include "base/keyboard_codes.h" |
| 10 #include "chrome/browser/renderer_host/backing_store.h" | 10 #include "chrome/browser/renderer_host/backing_store.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) | 113 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) |
| 114 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) | 114 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) |
| 115 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintRect, OnMsgPaintRect) | 115 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintRect, OnMsgPaintRect) |
| 116 IPC_MESSAGE_HANDLER(ViewHostMsg_ScrollRect, OnMsgScrollRect) | 116 IPC_MESSAGE_HANDLER(ViewHostMsg_ScrollRect, OnMsgScrollRect) |
| 117 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) | 117 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) |
| 118 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) | 118 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) |
| 119 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) | 119 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) |
| 120 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) | 120 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) |
| 121 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeUpdateStatus, OnMsgImeUpdateStatus) | 121 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeUpdateStatus, OnMsgImeUpdateStatus) |
| 122 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_ShowPopup, OnMsgShowPopup(msg)) | 122 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_ShowPopup, OnMsgShowPopup(msg)) |
| 123 #if defined(OS_LINUX) |
| 124 IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer, |
| 125 OnMsgCreatePluginContainer) |
| 126 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, |
| 127 OnMsgDestroyPluginContainer) |
| 128 #endif |
| 123 IPC_MESSAGE_UNHANDLED_ERROR() | 129 IPC_MESSAGE_UNHANDLED_ERROR() |
| 124 IPC_END_MESSAGE_MAP() | 130 IPC_END_MESSAGE_MAP() |
| 125 | 131 |
| 126 bool RenderWidgetHost::Send(IPC::Message* msg) { | 132 bool RenderWidgetHost::Send(IPC::Message* msg) { |
| 127 return process_->Send(msg); | 133 return process_->Send(msg); |
| 128 } | 134 } |
| 129 | 135 |
| 130 void RenderWidgetHost::WasHidden() { | 136 void RenderWidgetHost::WasHidden() { |
| 131 is_hidden_ = true; | 137 is_hidden_ = true; |
| 132 | 138 |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 | 747 |
| 742 view_->ShowPopupWithItems(validated_params.bounds, | 748 view_->ShowPopupWithItems(validated_params.bounds, |
| 743 validated_params.item_height, | 749 validated_params.item_height, |
| 744 validated_params.selected_item, | 750 validated_params.selected_item, |
| 745 validated_params.popup_items); | 751 validated_params.popup_items); |
| 746 #else // OS_WIN || OS_LINUX | 752 #else // OS_WIN || OS_LINUX |
| 747 NOTREACHED(); | 753 NOTREACHED(); |
| 748 #endif | 754 #endif |
| 749 } | 755 } |
| 750 | 756 |
| 757 #if defined(OS_LINUX) |
| 758 void RenderWidgetHost::OnMsgCreatePluginContainer( |
| 759 gfx::PluginWindowHandle *container) { |
| 760 *container = view_->CreatePluginContainer(); |
| 761 } |
| 762 |
| 763 void RenderWidgetHost::OnMsgDestroyPluginContainer( |
| 764 gfx::PluginWindowHandle container) { |
| 765 view_->DestroyPluginContainer(container); |
| 766 } |
| 767 #endif |
| 768 |
| 751 void RenderWidgetHost::PaintBackingStoreRect(TransportDIB* bitmap, | 769 void RenderWidgetHost::PaintBackingStoreRect(TransportDIB* bitmap, |
| 752 const gfx::Rect& bitmap_rect, | 770 const gfx::Rect& bitmap_rect, |
| 753 const gfx::Size& view_size) { | 771 const gfx::Size& view_size) { |
| 754 // The view may be destroyed already. | 772 // The view may be destroyed already. |
| 755 if (!view_) | 773 if (!view_) |
| 756 return; | 774 return; |
| 757 | 775 |
| 758 if (is_hidden_) { | 776 if (is_hidden_) { |
| 759 // Don't bother updating the backing store when we're hidden. Just mark it | 777 // Don't bother updating the backing store when we're hidden. Just mark it |
| 760 // as being totally invalid. This will cause a complete repaint when the | 778 // as being totally invalid. This will cause a complete repaint when the |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 810 |
| 793 // TODO(darin): do we need to do something else if our backing store is not | 811 // TODO(darin): do we need to do something else if our backing store is not |
| 794 // the same size as the advertised view? maybe we just assume there is a | 812 // the same size as the advertised view? maybe we just assume there is a |
| 795 // full paint on its way? | 813 // full paint on its way? |
| 796 BackingStore* backing_store = BackingStoreManager::Lookup(this); | 814 BackingStore* backing_store = BackingStoreManager::Lookup(this); |
| 797 if (!backing_store || (backing_store->size() != view_size)) | 815 if (!backing_store || (backing_store->size() != view_size)) |
| 798 return; | 816 return; |
| 799 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, | 817 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, |
| 800 dx, dy, clip_rect, view_size); | 818 dx, dy, clip_rect, view_size); |
| 801 } | 819 } |
| OLD | NEW |