| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "cc/scheduler/begin_frame_source.h" | 28 #include "cc/scheduler/begin_frame_source.h" |
| 29 #include "content/common/content_switches_internal.h" | 29 #include "content/common/content_switches_internal.h" |
| 30 #include "content/common/input/synthetic_gesture_packet.h" | 30 #include "content/common/input/synthetic_gesture_packet.h" |
| 31 #include "content/common/input_messages.h" | 31 #include "content/common/input_messages.h" |
| 32 #include "content/common/swapped_out_messages.h" | 32 #include "content/common/swapped_out_messages.h" |
| 33 #include "content/common/text_input_state.h" | 33 #include "content/common/text_input_state.h" |
| 34 #include "content/common/view_messages.h" | 34 #include "content/common/view_messages.h" |
| 35 #include "content/public/common/content_features.h" | 35 #include "content/public/common/content_features.h" |
| 36 #include "content/public/common/content_switches.h" | 36 #include "content/public/common/content_switches.h" |
| 37 #include "content/public/common/context_menu_params.h" | 37 #include "content/public/common/context_menu_params.h" |
| 38 #include "content/public/common/form_field_data.h" |
| 38 #include "content/renderer/cursor_utils.h" | 39 #include "content/renderer/cursor_utils.h" |
| 39 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h" | 40 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h" |
| 40 #include "content/renderer/external_popup_menu.h" | 41 #include "content/renderer/external_popup_menu.h" |
| 41 #include "content/renderer/gpu/frame_swap_message_queue.h" | 42 #include "content/renderer/gpu/frame_swap_message_queue.h" |
| 42 #include "content/renderer/gpu/queue_message_swap_promise.h" | 43 #include "content/renderer/gpu/queue_message_swap_promise.h" |
| 43 #include "content/renderer/gpu/render_widget_compositor.h" | 44 #include "content/renderer/gpu/render_widget_compositor.h" |
| 44 #include "content/renderer/ime_event_guard.h" | 45 #include "content/renderer/ime_event_guard.h" |
| 45 #include "content/renderer/input/input_handler_manager.h" | 46 #include "content/renderer/input/input_handler_manager.h" |
| 46 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 47 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 47 #include "content/renderer/render_frame_impl.h" | 48 #include "content/renderer/render_frame_impl.h" |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 OnRequestCompositionUpdate) | 527 OnRequestCompositionUpdate) |
| 527 #if defined(OS_ANDROID) | 528 #if defined(OS_ANDROID) |
| 528 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) | 529 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) |
| 529 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, | 530 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, |
| 530 OnRequestTextInputStateUpdate) | 531 OnRequestTextInputStateUpdate) |
| 531 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit, | 532 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit, |
| 532 OnImeBatchEdit) | 533 OnImeBatchEdit) |
| 533 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) | 534 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) |
| 534 #endif | 535 #endif |
| 535 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) | 536 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) |
| 537 IPC_MESSAGE_HANDLER(ViewMsg_GetFocusedFormFieldData, |
| 538 OnFocusedFormFieldDataRequested) |
| 536 IPC_MESSAGE_UNHANDLED(handled = false) | 539 IPC_MESSAGE_UNHANDLED(handled = false) |
| 537 IPC_END_MESSAGE_MAP() | 540 IPC_END_MESSAGE_MAP() |
| 538 return handled; | 541 return handled; |
| 539 } | 542 } |
| 540 | 543 |
| 541 bool RenderWidget::Send(IPC::Message* message) { | 544 bool RenderWidget::Send(IPC::Message* message) { |
| 542 // Don't send any messages after the browser has told us to close, and filter | 545 // Don't send any messages after the browser has told us to close, and filter |
| 543 // most outgoing messages while swapped out. | 546 // most outgoing messages while swapped out. |
| 544 if ((is_swapped_out_ && | 547 if ((is_swapped_out_ && |
| 545 !SwappedOutMessages::CanSendWhileSwappedOut(message)) || | 548 !SwappedOutMessages::CanSendWhileSwappedOut(message)) || |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 void RenderWidget::OnSetFrameSinkId(const cc::FrameSinkId& frame_sink_id) { | 1528 void RenderWidget::OnSetFrameSinkId(const cc::FrameSinkId& frame_sink_id) { |
| 1526 if (compositor_) | 1529 if (compositor_) |
| 1527 compositor_->SetFrameSinkId(frame_sink_id); | 1530 compositor_->SetFrameSinkId(frame_sink_id); |
| 1528 } | 1531 } |
| 1529 | 1532 |
| 1530 void RenderWidget::OnHandleCompositorProto(const std::vector<uint8_t>& proto) { | 1533 void RenderWidget::OnHandleCompositorProto(const std::vector<uint8_t>& proto) { |
| 1531 if (compositor_) | 1534 if (compositor_) |
| 1532 compositor_->OnHandleCompositorProto(proto); | 1535 compositor_->OnHandleCompositorProto(proto); |
| 1533 } | 1536 } |
| 1534 | 1537 |
| 1538 void RenderWidget::OnFocusedFormFieldDataRequested(int request_id) { |
| 1539 blink::WebTextInputInfo info = GetWebWidget()->textInputInfo(); |
| 1540 FormFieldData field; |
| 1541 field.text = info.value.utf8(); |
| 1542 field.placeholder = info.placeholder.utf8(); |
| 1543 field.text_input_type = GetTextInputType(); |
| 1544 Send( |
| 1545 new ViewHostMsg_SetFocusedFormFieldData(routing_id(), request_id, field)); |
| 1546 } |
| 1547 |
| 1535 void RenderWidget::showImeIfNeeded() { | 1548 void RenderWidget::showImeIfNeeded() { |
| 1536 OnShowImeIfNeeded(); | 1549 OnShowImeIfNeeded(); |
| 1537 } | 1550 } |
| 1538 | 1551 |
| 1539 ui::TextInputType RenderWidget::GetTextInputType() { | 1552 ui::TextInputType RenderWidget::GetTextInputType() { |
| 1540 #if defined(ENABLE_PLUGINS) | 1553 #if defined(ENABLE_PLUGINS) |
| 1541 if (focused_pepper_plugin_) | 1554 if (focused_pepper_plugin_) |
| 1542 return focused_pepper_plugin_->text_input_type(); | 1555 return focused_pepper_plugin_->text_input_type(); |
| 1543 #endif | 1556 #endif |
| 1544 if (GetWebWidget()) | 1557 if (GetWebWidget()) |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2161 bool RenderWidget::isPointerLocked() { | 2174 bool RenderWidget::isPointerLocked() { |
| 2162 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2175 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2163 webwidget_mouse_lock_target_.get()); | 2176 webwidget_mouse_lock_target_.get()); |
| 2164 } | 2177 } |
| 2165 | 2178 |
| 2166 blink::WebWidget* RenderWidget::GetWebWidget() const { | 2179 blink::WebWidget* RenderWidget::GetWebWidget() const { |
| 2167 return webwidget_internal_; | 2180 return webwidget_internal_; |
| 2168 } | 2181 } |
| 2169 | 2182 |
| 2170 } // namespace content | 2183 } // namespace content |
| OLD | NEW |