| 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 return true; | 480 return true; |
| 481 | 481 |
| 482 bool handled = true; | 482 bool handled = true; |
| 483 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) | 483 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) |
| 484 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) | 484 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) |
| 485 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, | 485 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, |
| 486 OnCursorVisibilityChange) | 486 OnCursorVisibilityChange) |
| 487 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) | 487 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) |
| 488 IPC_MESSAGE_HANDLER(InputMsg_ImeConfirmComposition, OnImeConfirmComposition) | 488 IPC_MESSAGE_HANDLER(InputMsg_ImeConfirmComposition, OnImeConfirmComposition) |
| 489 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) | 489 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) |
| 490 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
| 491 OnSetEditCommandsForNextKeyEvent) |
| 490 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) | 492 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) |
| 491 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, | 493 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, |
| 492 OnSyntheticGestureCompleted) | 494 OnSyntheticGestureCompleted) |
| 493 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 495 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
| 494 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) | 496 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) |
| 495 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, | 497 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, |
| 496 OnEnableDeviceEmulation) | 498 OnEnableDeviceEmulation) |
| 497 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, | 499 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, |
| 498 OnDisableDeviceEmulation) | 500 OnDisableDeviceEmulation) |
| 499 IPC_MESSAGE_HANDLER(ViewMsg_ChangeResizeRect, OnChangeResizeRect) | 501 IPC_MESSAGE_HANDLER(ViewMsg_ChangeResizeRect, OnChangeResizeRect) |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 void RenderWidget::OnCursorVisibilityChange(bool is_visible) { | 691 void RenderWidget::OnCursorVisibilityChange(bool is_visible) { |
| 690 if (webwidget_) | 692 if (webwidget_) |
| 691 webwidget_->setCursorVisibilityState(is_visible); | 693 webwidget_->setCursorVisibilityState(is_visible); |
| 692 } | 694 } |
| 693 | 695 |
| 694 void RenderWidget::OnMouseCaptureLost() { | 696 void RenderWidget::OnMouseCaptureLost() { |
| 695 if (webwidget_) | 697 if (webwidget_) |
| 696 webwidget_->mouseCaptureLost(); | 698 webwidget_->mouseCaptureLost(); |
| 697 } | 699 } |
| 698 | 700 |
| 701 void RenderWidget::OnSetEditCommandsForNextKeyEvent( |
| 702 const EditCommands& edit_commands) { |
| 703 edit_commands_ = edit_commands; |
| 704 } |
| 705 |
| 699 void RenderWidget::OnSetFocus(bool enable) { | 706 void RenderWidget::OnSetFocus(bool enable) { |
| 700 has_focus_ = enable; | 707 has_focus_ = enable; |
| 701 | 708 |
| 702 if (webwidget_) | 709 if (webwidget_) |
| 703 webwidget_->setFocus(enable); | 710 webwidget_->setFocus(enable); |
| 704 | 711 |
| 705 FOR_EACH_OBSERVER(RenderFrameImpl, render_frames_, | 712 FOR_EACH_OBSERVER(RenderFrameImpl, render_frames_, |
| 706 RenderWidgetSetFocus(enable)); | 713 RenderWidgetSetFocus(enable)); |
| 707 } | 714 } |
| 708 | 715 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 888 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 882 InputHandlerManager* input_handler_manager = | 889 InputHandlerManager* input_handler_manager = |
| 883 render_thread ? render_thread->input_handler_manager() : NULL; | 890 render_thread ? render_thread->input_handler_manager() : NULL; |
| 884 if (input_handler_manager) { | 891 if (input_handler_manager) { |
| 885 input_handler_manager->ObserveGestureEventAndResultOnMainThread( | 892 input_handler_manager->ObserveGestureEventAndResultOnMainThread( |
| 886 routing_id_, gesture_event, scroll_result); | 893 routing_id_, gesture_event, scroll_result); |
| 887 } | 894 } |
| 888 } | 895 } |
| 889 | 896 |
| 890 void RenderWidget::OnDidHandleKeyEvent() { | 897 void RenderWidget::OnDidHandleKeyEvent() { |
| 891 if (owner_delegate_) | 898 ClearEditCommands(); |
| 892 owner_delegate_->RenderWidgetDidHandleKeyEvent(); | 899 } |
| 900 |
| 901 void RenderWidget::SetEditCommandForNextKeyEvent(const std::string& name, |
| 902 const std::string& value) { |
| 903 ClearEditCommands(); |
| 904 edit_commands_.emplace_back(name, value); |
| 905 } |
| 906 |
| 907 void RenderWidget::ClearEditCommands() { |
| 908 edit_commands_.clear(); |
| 893 } | 909 } |
| 894 | 910 |
| 895 void RenderWidget::OnDidOverscroll(const ui::DidOverscrollParams& params) { | 911 void RenderWidget::OnDidOverscroll(const ui::DidOverscrollParams& params) { |
| 896 Send(new InputHostMsg_DidOverscroll(routing_id_, params)); | 912 Send(new InputHostMsg_DidOverscroll(routing_id_, params)); |
| 897 } | 913 } |
| 898 | 914 |
| 899 void RenderWidget::OnInputEventAck( | 915 void RenderWidget::OnInputEventAck( |
| 900 std::unique_ptr<InputEventAck> input_event_ack) { | 916 std::unique_ptr<InputEventAck> input_event_ack) { |
| 901 Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, *input_event_ack)); | 917 Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, *input_event_ack)); |
| 902 } | 918 } |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2087 void RenderWidget::requestPointerUnlock() { | 2103 void RenderWidget::requestPointerUnlock() { |
| 2088 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); | 2104 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); |
| 2089 } | 2105 } |
| 2090 | 2106 |
| 2091 bool RenderWidget::isPointerLocked() { | 2107 bool RenderWidget::isPointerLocked() { |
| 2092 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2108 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2093 webwidget_mouse_lock_target_.get()); | 2109 webwidget_mouse_lock_target_.get()); |
| 2094 } | 2110 } |
| 2095 | 2111 |
| 2096 } // namespace content | 2112 } // namespace content |
| OLD | NEW |