| 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 return true; | 469 return true; |
| 470 | 470 |
| 471 bool handled = true; | 471 bool handled = true; |
| 472 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) | 472 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) |
| 473 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) | 473 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) |
| 474 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, | 474 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, |
| 475 OnCursorVisibilityChange) | 475 OnCursorVisibilityChange) |
| 476 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) | 476 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) |
| 477 IPC_MESSAGE_HANDLER(InputMsg_ImeConfirmComposition, OnImeConfirmComposition) | 477 IPC_MESSAGE_HANDLER(InputMsg_ImeConfirmComposition, OnImeConfirmComposition) |
| 478 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) | 478 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) |
| 479 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
| 480 OnSetEditCommandsForNextKeyEvent) |
| 479 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) | 481 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) |
| 480 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, | 482 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, |
| 481 OnSyntheticGestureCompleted) | 483 OnSyntheticGestureCompleted) |
| 482 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 484 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
| 483 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) | 485 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) |
| 484 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, | 486 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, |
| 485 OnEnableDeviceEmulation) | 487 OnEnableDeviceEmulation) |
| 486 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, | 488 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, |
| 487 OnDisableDeviceEmulation) | 489 OnDisableDeviceEmulation) |
| 488 IPC_MESSAGE_HANDLER(ViewMsg_ChangeResizeRect, OnChangeResizeRect) | 490 IPC_MESSAGE_HANDLER(ViewMsg_ChangeResizeRect, OnChangeResizeRect) |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 void RenderWidget::OnCursorVisibilityChange(bool is_visible) { | 680 void RenderWidget::OnCursorVisibilityChange(bool is_visible) { |
| 679 if (webwidget_) | 681 if (webwidget_) |
| 680 webwidget_->setCursorVisibilityState(is_visible); | 682 webwidget_->setCursorVisibilityState(is_visible); |
| 681 } | 683 } |
| 682 | 684 |
| 683 void RenderWidget::OnMouseCaptureLost() { | 685 void RenderWidget::OnMouseCaptureLost() { |
| 684 if (webwidget_) | 686 if (webwidget_) |
| 685 webwidget_->mouseCaptureLost(); | 687 webwidget_->mouseCaptureLost(); |
| 686 } | 688 } |
| 687 | 689 |
| 690 void RenderWidget::OnSetEditCommandsForNextKeyEvent( |
| 691 const EditCommands& edit_commands) { |
| 692 edit_commands_ = edit_commands; |
| 693 } |
| 694 |
| 688 void RenderWidget::OnSetFocus(bool enable) { | 695 void RenderWidget::OnSetFocus(bool enable) { |
| 689 has_focus_ = enable; | 696 has_focus_ = enable; |
| 690 | 697 |
| 691 if (webwidget_) | 698 if (webwidget_) |
| 692 webwidget_->setFocus(enable); | 699 webwidget_->setFocus(enable); |
| 693 | 700 |
| 694 FOR_EACH_OBSERVER(RenderFrameImpl, render_frames_, | 701 FOR_EACH_OBSERVER(RenderFrameImpl, render_frames_, |
| 695 RenderWidgetSetFocus(enable)); | 702 RenderWidgetSetFocus(enable)); |
| 696 } | 703 } |
| 697 | 704 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 863 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 857 InputHandlerManager* input_handler_manager = | 864 InputHandlerManager* input_handler_manager = |
| 858 render_thread ? render_thread->input_handler_manager() : NULL; | 865 render_thread ? render_thread->input_handler_manager() : NULL; |
| 859 if (input_handler_manager) { | 866 if (input_handler_manager) { |
| 860 input_handler_manager->ObserveGestureEventAndResultOnMainThread( | 867 input_handler_manager->ObserveGestureEventAndResultOnMainThread( |
| 861 routing_id_, gesture_event, scroll_result); | 868 routing_id_, gesture_event, scroll_result); |
| 862 } | 869 } |
| 863 } | 870 } |
| 864 | 871 |
| 865 void RenderWidget::OnDidHandleKeyEvent() { | 872 void RenderWidget::OnDidHandleKeyEvent() { |
| 866 if (owner_delegate_) | 873 ClearEditCommands(); |
| 867 owner_delegate_->RenderWidgetDidHandleKeyEvent(); | 874 } |
| 875 |
| 876 void RenderWidget::SetEditCommandForNextKeyEvent(const std::string& name, |
| 877 const std::string& value) { |
| 878 ClearEditCommands(); |
| 879 edit_commands_.emplace_back(name, value); |
| 880 } |
| 881 |
| 882 void RenderWidget::ClearEditCommands() { |
| 883 edit_commands_.clear(); |
| 868 } | 884 } |
| 869 | 885 |
| 870 void RenderWidget::OnDidOverscroll(const ui::DidOverscrollParams& params) { | 886 void RenderWidget::OnDidOverscroll(const ui::DidOverscrollParams& params) { |
| 871 Send(new InputHostMsg_DidOverscroll(routing_id_, params)); | 887 Send(new InputHostMsg_DidOverscroll(routing_id_, params)); |
| 872 } | 888 } |
| 873 | 889 |
| 874 void RenderWidget::OnInputEventAck( | 890 void RenderWidget::OnInputEventAck( |
| 875 std::unique_ptr<InputEventAck> input_event_ack) { | 891 std::unique_ptr<InputEventAck> input_event_ack) { |
| 876 Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, *input_event_ack)); | 892 Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, *input_event_ack)); |
| 877 } | 893 } |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2066 void RenderWidget::requestPointerUnlock() { | 2082 void RenderWidget::requestPointerUnlock() { |
| 2067 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); | 2083 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); |
| 2068 } | 2084 } |
| 2069 | 2085 |
| 2070 bool RenderWidget::isPointerLocked() { | 2086 bool RenderWidget::isPointerLocked() { |
| 2071 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2087 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2072 webwidget_mouse_lock_target_.get()); | 2088 webwidget_mouse_lock_target_.get()); |
| 2073 } | 2089 } |
| 2074 | 2090 |
| 2075 } // namespace content | 2091 } // namespace content |
| OLD | NEW |