OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) | 746 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) |
747 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) | 747 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) |
748 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) | 748 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) |
749 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) | 749 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) |
750 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) | 750 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) |
751 IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceIdNamespace, OnSetSurfaceIdNamespace) | 751 IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceIdNamespace, OnSetSurfaceIdNamespace) |
752 #if defined(OS_ANDROID) | 752 #if defined(OS_ANDROID) |
753 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) | 753 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) |
754 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) | 754 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) |
755 #endif | 755 #endif |
| 756 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) |
756 IPC_MESSAGE_UNHANDLED(handled = false) | 757 IPC_MESSAGE_UNHANDLED(handled = false) |
757 IPC_END_MESSAGE_MAP() | 758 IPC_END_MESSAGE_MAP() |
758 return handled; | 759 return handled; |
759 } | 760 } |
760 | 761 |
761 bool RenderWidget::Send(IPC::Message* message) { | 762 bool RenderWidget::Send(IPC::Message* message) { |
762 // Don't send any messages after the browser has told us to close, and filter | 763 // Don't send any messages after the browser has told us to close, and filter |
763 // most outgoing messages while swapped out. | 764 // most outgoing messages while swapped out. |
764 if ((is_swapped_out_ && | 765 if ((is_swapped_out_ && |
765 !SwappedOutMessages::CanSendWhileSwappedOut(message)) || | 766 !SwappedOutMessages::CanSendWhileSwappedOut(message)) || |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 window_screen_rect_ = window_screen_rect; | 1747 window_screen_rect_ = window_screen_rect; |
1747 } | 1748 } |
1748 Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id())); | 1749 Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id())); |
1749 } | 1750 } |
1750 | 1751 |
1751 void RenderWidget::OnSetSurfaceIdNamespace(uint32_t surface_id_namespace) { | 1752 void RenderWidget::OnSetSurfaceIdNamespace(uint32_t surface_id_namespace) { |
1752 if (compositor_) | 1753 if (compositor_) |
1753 compositor_->SetSurfaceIdNamespace(surface_id_namespace); | 1754 compositor_->SetSurfaceIdNamespace(surface_id_namespace); |
1754 } | 1755 } |
1755 | 1756 |
| 1757 void RenderWidget::OnHandleCompositorProto(const std::vector<uint8_t>& proto) { |
| 1758 if (compositor_) |
| 1759 compositor_->OnHandleCompositorProto(proto); |
| 1760 } |
| 1761 |
1756 void RenderWidget::showImeIfNeeded() { | 1762 void RenderWidget::showImeIfNeeded() { |
1757 OnShowImeIfNeeded(); | 1763 OnShowImeIfNeeded(); |
1758 } | 1764 } |
1759 | 1765 |
1760 void RenderWidget::OnShowImeIfNeeded() { | 1766 void RenderWidget::OnShowImeIfNeeded() { |
1761 #if defined(OS_ANDROID) || defined(USE_AURA) | 1767 #if defined(OS_ANDROID) || defined(USE_AURA) |
1762 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); | 1768 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); |
1763 #endif | 1769 #endif |
1764 | 1770 |
1765 // TODO(rouslan): Fix ChromeOS and Windows 8 behavior of autofill popup with | 1771 // TODO(rouslan): Fix ChromeOS and Windows 8 behavior of autofill popup with |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2040 selection_focus_rect_ = params.focus_rect; | 2046 selection_focus_rect_ = params.focus_rect; |
2041 webwidget_->selectionTextDirection(params.focus_dir, params.anchor_dir); | 2047 webwidget_->selectionTextDirection(params.focus_dir, params.anchor_dir); |
2042 params.is_anchor_first = webwidget_->isSelectionAnchorFirst(); | 2048 params.is_anchor_first = webwidget_->isSelectionAnchorFirst(); |
2043 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); | 2049 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); |
2044 } | 2050 } |
2045 } | 2051 } |
2046 | 2052 |
2047 UpdateCompositionInfo(false); | 2053 UpdateCompositionInfo(false); |
2048 } | 2054 } |
2049 | 2055 |
| 2056 void RenderWidget::ForwardCompositorProto(const std::vector<uint8_t>& proto) { |
| 2057 Send(new ViewHostMsg_ForwardCompositorProto(routing_id_, proto)); |
| 2058 } |
| 2059 |
2050 // Check blink::WebTextInputType and ui::TextInputType is kept in sync. | 2060 // Check blink::WebTextInputType and ui::TextInputType is kept in sync. |
2051 #define STATIC_ASSERT_WTIT_ENUM_MATCH(a, b) \ | 2061 #define STATIC_ASSERT_WTIT_ENUM_MATCH(a, b) \ |
2052 static_assert(int(blink::WebTextInputType##a) \ | 2062 static_assert(int(blink::WebTextInputType##a) \ |
2053 == int(ui::TEXT_INPUT_TYPE_##b), \ | 2063 == int(ui::TEXT_INPUT_TYPE_##b), \ |
2054 "mismatching enums: " #a) | 2064 "mismatching enums: " #a) |
2055 | 2065 |
2056 STATIC_ASSERT_WTIT_ENUM_MATCH(None, NONE); | 2066 STATIC_ASSERT_WTIT_ENUM_MATCH(None, NONE); |
2057 STATIC_ASSERT_WTIT_ENUM_MATCH(Text, TEXT); | 2067 STATIC_ASSERT_WTIT_ENUM_MATCH(Text, TEXT); |
2058 STATIC_ASSERT_WTIT_ENUM_MATCH(Password, PASSWORD); | 2068 STATIC_ASSERT_WTIT_ENUM_MATCH(Password, PASSWORD); |
2059 STATIC_ASSERT_WTIT_ENUM_MATCH(Search, SEARCH); | 2069 STATIC_ASSERT_WTIT_ENUM_MATCH(Search, SEARCH); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2441 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2451 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2442 video_hole_frames_.AddObserver(frame); | 2452 video_hole_frames_.AddObserver(frame); |
2443 } | 2453 } |
2444 | 2454 |
2445 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2455 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2446 video_hole_frames_.RemoveObserver(frame); | 2456 video_hole_frames_.RemoveObserver(frame); |
2447 } | 2457 } |
2448 #endif // defined(VIDEO_HOLE) | 2458 #endif // defined(VIDEO_HOLE) |
2449 | 2459 |
2450 } // namespace content | 2460 } // namespace content |
OLD | NEW |