| 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/gfx/native_widget_types.h" | 7 #include "base/gfx/native_widget_types.h" |
| 8 #include "base/histogram.h" | 8 #include "base/histogram.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) | 107 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) |
| 108 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) | 108 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) |
| 109 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) | 109 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) |
| 110 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintRect, OnMsgPaintRect) | 110 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintRect, OnMsgPaintRect) |
| 111 IPC_MESSAGE_HANDLER(ViewHostMsg_ScrollRect, OnMsgScrollRect) | 111 IPC_MESSAGE_HANDLER(ViewHostMsg_ScrollRect, OnMsgScrollRect) |
| 112 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) | 112 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) |
| 113 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) | 113 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) |
| 114 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) | 114 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) |
| 115 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) | 115 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) |
| 116 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeUpdateStatus, OnMsgImeUpdateStatus) | 116 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeUpdateStatus, OnMsgImeUpdateStatus) |
| 117 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_ShowPopup, OnMsgShowPopup(msg)) |
| 117 IPC_MESSAGE_UNHANDLED_ERROR() | 118 IPC_MESSAGE_UNHANDLED_ERROR() |
| 118 IPC_END_MESSAGE_MAP() | 119 IPC_END_MESSAGE_MAP() |
| 119 | 120 |
| 120 bool RenderWidgetHost::Send(IPC::Message* msg) { | 121 bool RenderWidgetHost::Send(IPC::Message* msg) { |
| 121 return process_->Send(msg); | 122 return process_->Send(msg); |
| 122 } | 123 } |
| 123 | 124 |
| 124 void RenderWidgetHost::WasHidden() { | 125 void RenderWidgetHost::WasHidden() { |
| 125 is_hidden_ = true; | 126 is_hidden_ = true; |
| 126 | 127 |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 view_->UpdateCursor(cursor); | 656 view_->UpdateCursor(cursor); |
| 656 } | 657 } |
| 657 | 658 |
| 658 void RenderWidgetHost::OnMsgImeUpdateStatus(int control, | 659 void RenderWidgetHost::OnMsgImeUpdateStatus(int control, |
| 659 const gfx::Rect& caret_rect) { | 660 const gfx::Rect& caret_rect) { |
| 660 if (view_) { | 661 if (view_) { |
| 661 view_->IMEUpdateStatus(control, caret_rect); | 662 view_->IMEUpdateStatus(control, caret_rect); |
| 662 } | 663 } |
| 663 } | 664 } |
| 664 | 665 |
| 666 void RenderWidgetHost::OnMsgShowPopup(const IPC::Message& message) { |
| 667 #if defined(OS_MACOSX) |
| 668 void* iter = NULL; |
| 669 ViewHostMsg_ShowPopup_Params validated_params; |
| 670 if (!IPC::ParamTraits<ViewHostMsg_ShowPopup_Params>::Read(&message, &iter, |
| 671 &validated_params)) |
| 672 return; |
| 673 |
| 674 view_->ShowPopupWithItems(validated_params.bounds, |
| 675 validated_params.item_height, |
| 676 validated_params.selected_item, |
| 677 validated_params.popup_items); |
| 678 #else // OS_WIN || OS_LINUX |
| 679 NOTREACHED(); |
| 680 #endif |
| 681 } |
| 682 |
| 665 void RenderWidgetHost::PaintBackingStoreRect(TransportDIB* bitmap, | 683 void RenderWidgetHost::PaintBackingStoreRect(TransportDIB* bitmap, |
| 666 const gfx::Rect& bitmap_rect, | 684 const gfx::Rect& bitmap_rect, |
| 667 const gfx::Size& view_size) { | 685 const gfx::Size& view_size) { |
| 668 if (is_hidden_) { | 686 if (is_hidden_) { |
| 669 // Don't bother updating the backing store when we're hidden. Just mark it | 687 // Don't bother updating the backing store when we're hidden. Just mark it |
| 670 // as being totally invalid. This will cause a complete repaint when the | 688 // as being totally invalid. This will cause a complete repaint when the |
| 671 // view is restored. | 689 // view is restored. |
| 672 needs_repainting_on_restore_ = true; | 690 needs_repainting_on_restore_ = true; |
| 673 return; | 691 return; |
| 674 } | 692 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 702 | 720 |
| 703 // TODO(darin): do we need to do something else if our backing store is not | 721 // TODO(darin): do we need to do something else if our backing store is not |
| 704 // the same size as the advertised view? maybe we just assume there is a | 722 // the same size as the advertised view? maybe we just assume there is a |
| 705 // full paint on its way? | 723 // full paint on its way? |
| 706 BackingStore* backing_store = BackingStoreManager::Lookup(this); | 724 BackingStore* backing_store = BackingStoreManager::Lookup(this); |
| 707 if (!backing_store || (backing_store->size() != view_size)) | 725 if (!backing_store || (backing_store->size() != view_size)) |
| 708 return; | 726 return; |
| 709 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, | 727 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, |
| 710 dx, dy, clip_rect, view_size); | 728 dx, dy, clip_rect, view_size); |
| 711 } | 729 } |
| OLD | NEW |