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/renderer/render_widget.h" | 5 #include "chrome/renderer/render_widget.h" |
6 | 6 |
7 #include "app/surface/transport_dib.h" | 7 #include "app/surface/transport_dib.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 } | 735 } |
736 | 736 |
737 void RenderWidget::OnImeConfirmComposition() { | 737 void RenderWidget::OnImeConfirmComposition() { |
738 if (webwidget_) | 738 if (webwidget_) |
739 webwidget_->confirmComposition(); | 739 webwidget_->confirmComposition(); |
740 } | 740 } |
741 | 741 |
742 // This message causes the renderer to render an image of the | 742 // This message causes the renderer to render an image of the |
743 // desired_size, regardless of whether the tab is hidden or not. | 743 // desired_size, regardless of whether the tab is hidden or not. |
744 void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle, | 744 void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle, |
| 745 int tag, |
745 const gfx::Size& page_size, | 746 const gfx::Size& page_size, |
746 const gfx::Size& desired_size) { | 747 const gfx::Size& desired_size) { |
747 if (!webwidget_ || dib_handle == TransportDIB::DefaultHandleValue()) | 748 if (!webwidget_ || dib_handle == TransportDIB::DefaultHandleValue()) |
748 return; | 749 return; |
749 | 750 |
750 if (page_size.IsEmpty() || desired_size.IsEmpty()) { | 751 if (page_size.IsEmpty() || desired_size.IsEmpty()) { |
751 // If one of these is empty, then we just return the dib we were | 752 // If one of these is empty, then we just return the dib we were |
752 // given, to avoid leaking it. | 753 // given, to avoid leaking it. |
753 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, | 754 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size)); |
754 dib_handle, | |
755 desired_size)); | |
756 return; | 755 return; |
757 } | 756 } |
758 | 757 |
759 // Map the given DIB ID into this process, and unmap it at the end | 758 // Map the given DIB ID into this process, and unmap it at the end |
760 // of this function. | 759 // of this function. |
761 scoped_ptr<TransportDIB> paint_at_size_buffer(TransportDIB::Map(dib_handle)); | 760 scoped_ptr<TransportDIB> paint_at_size_buffer(TransportDIB::Map(dib_handle)); |
762 | 761 |
763 DCHECK(paint_at_size_buffer.get()); | 762 DCHECK(paint_at_size_buffer.get()); |
764 if (!paint_at_size_buffer.get()) | 763 if (!paint_at_size_buffer.get()) |
765 return; | 764 return; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 webwidget_->resize(page_size); | 799 webwidget_->resize(page_size); |
801 webwidget_->layout(); | 800 webwidget_->layout(); |
802 | 801 |
803 // Paint the entire thing (using original bounds, not scaled bounds). | 802 // Paint the entire thing (using original bounds, not scaled bounds). |
804 PaintRect(orig_bounds, orig_bounds.origin(), canvas.get()); | 803 PaintRect(orig_bounds, orig_bounds.origin(), canvas.get()); |
805 canvas->restore(); | 804 canvas->restore(); |
806 | 805 |
807 // Return the widget to its previous size. | 806 // Return the widget to its previous size. |
808 webwidget_->resize(old_size); | 807 webwidget_->resize(old_size); |
809 | 808 |
810 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, dib_handle, bounds.size())); | 809 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, bounds.size())); |
811 } | 810 } |
812 | 811 |
813 void RenderWidget::OnMsgRepaint(const gfx::Size& size_to_paint) { | 812 void RenderWidget::OnMsgRepaint(const gfx::Size& size_to_paint) { |
814 // During shutdown we can just ignore this message. | 813 // During shutdown we can just ignore this message. |
815 if (!webwidget_) | 814 if (!webwidget_) |
816 return; | 815 return; |
817 | 816 |
818 set_next_paint_is_repaint_ack(); | 817 set_next_paint_is_repaint_ack(); |
819 gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height()); | 818 gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height()); |
820 didInvalidateRect(repaint_rect); | 819 didInvalidateRect(repaint_rect); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 | 925 |
927 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { | 926 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { |
928 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); | 927 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); |
929 i != plugin_window_moves_.end(); ++i) { | 928 i != plugin_window_moves_.end(); ++i) { |
930 if (i->window == window) { | 929 if (i->window == window) { |
931 plugin_window_moves_.erase(i); | 930 plugin_window_moves_.erase(i); |
932 break; | 931 break; |
933 } | 932 } |
934 } | 933 } |
935 } | 934 } |
OLD | NEW |