| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CONTENT_RENDERER_INPUT_RENDER_WIDGET_INPUT_HANDLER_DELEGATE_H_ | 5 #ifndef CONTENT_RENDERER_INPUT_RENDER_WIDGET_INPUT_HANDLER_DELEGATE_H_ |
| 6 #define CONTENT_RENDERER_INPUT_RENDER_WIDGET_INPUT_HANDLER_DELEGATE_H_ | 6 #define CONTENT_RENDERER_INPUT_RENDER_WIDGET_INPUT_HANDLER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/common/input/input_event_ack.h" | 11 #include "content/common/input/input_event_ack.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 class WebGestureEvent; | 14 class WebGestureEvent; |
| 15 class WebMouseEvent; | 15 class WebMouseEvent; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace gfx { | 18 namespace gfx { |
| 19 class Point; | 19 class Point; |
| 20 class Vector2dF; | 20 class Vector2dF; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 class RenderWidgetInputHandler; | 25 class RenderWidgetInputHandler; |
| 26 | 26 |
| 27 enum class ShowIme { IF_NEEDED, HIDE_IME }; | |
| 28 | |
| 29 enum class ChangeSource { | |
| 30 FROM_NON_IME, | |
| 31 FROM_IME, | |
| 32 }; | |
| 33 | |
| 34 // Consumers of RenderWidgetInputHandler implement this delegate in order to | 27 // Consumers of RenderWidgetInputHandler implement this delegate in order to |
| 35 // transport input handling information across processes. | 28 // transport input handling information across processes. |
| 36 class CONTENT_EXPORT RenderWidgetInputHandlerDelegate { | 29 class CONTENT_EXPORT RenderWidgetInputHandlerDelegate { |
| 37 public: | 30 public: |
| 38 // Called when animations due to focus change have completed (if any). | 31 // Called when animations due to focus change have completed (if any). |
| 39 virtual void FocusChangeComplete() = 0; | 32 virtual void FocusChangeComplete() = 0; |
| 40 | 33 |
| 41 // Check whether the WebWidget has any touch event handlers registered | 34 // Check whether the WebWidget has any touch event handlers registered |
| 42 // at the given point. | 35 // at the given point. |
| 43 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const = 0; | 36 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const = 0; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 61 | 54 |
| 62 // Called when an event with a notify dispatch type | 55 // Called when an event with a notify dispatch type |
| 63 // (DISPATCH_TYPE_*_NOTIFY_MAIN) of |handled_type| has been processed | 56 // (DISPATCH_TYPE_*_NOTIFY_MAIN) of |handled_type| has been processed |
| 64 // by the main thread. | 57 // by the main thread. |
| 65 virtual void NotifyInputEventHandled(blink::WebInputEvent::Type handled_type, | 58 virtual void NotifyInputEventHandled(blink::WebInputEvent::Type handled_type, |
| 66 InputEventAckState ack_result) = 0; | 59 InputEventAckState ack_result) = 0; |
| 67 | 60 |
| 68 // Notifies the delegate of the |input_handler| managing it. | 61 // Notifies the delegate of the |input_handler| managing it. |
| 69 virtual void SetInputHandler(RenderWidgetInputHandler* input_handler) = 0; | 62 virtual void SetInputHandler(RenderWidgetInputHandler* input_handler) = 0; |
| 70 | 63 |
| 71 // |show_ime| should be ShowIme::IF_NEEDED iff the update may cause the ime to | 64 // Call this if virtual keyboard should be displayed, e.g. after a tap on an |
| 72 // be displayed, e.g. after a tap on an input field on mobile. | 65 // input field on mobile. Note that we do this just by setting a bit in |
| 73 // |change_source| should be ChangeSource::FROM_NON_IME when the renderer has | 66 // text input state and update it to the browser such that browser process can |
| 74 // to wait for the browser to acknowledge the change before the renderer | 67 // be up to date when showing virtual keyboard. |
| 75 // handles any more IME events. This is when the text change did not originate | 68 virtual void ShowVirtualKeyboard() = 0; |
| 76 // from the IME in the browser side, such as changes by JavaScript or | 69 |
| 77 // autofill. | 70 // Send an update of text input state to the browser process. |
| 78 virtual void UpdateTextInputState(ShowIme show_ime, | 71 virtual void UpdateTextInputState() = 0; |
| 79 ChangeSource change_source) = 0; | |
| 80 | 72 |
| 81 // Notifies that a gesture event is about to be handled. | 73 // Notifies that a gesture event is about to be handled. |
| 82 // Returns true if no further handling is needed. In that case, the event | 74 // Returns true if no further handling is needed. In that case, the event |
| 83 // won't be sent to WebKit. | 75 // won't be sent to WebKit. |
| 84 virtual bool WillHandleGestureEvent(const blink::WebGestureEvent& event) = 0; | 76 virtual bool WillHandleGestureEvent(const blink::WebGestureEvent& event) = 0; |
| 85 | 77 |
| 86 // Notifies that a mouse event is about to be handled. | 78 // Notifies that a mouse event is about to be handled. |
| 87 // Returns true if no further handling is needed. In that case, the event | 79 // Returns true if no further handling is needed. In that case, the event |
| 88 // won't be sent to WebKit or trigger DidHandleMouseEvent(). | 80 // won't be sent to WebKit or trigger DidHandleMouseEvent(). |
| 89 virtual bool WillHandleMouseEvent(const blink::WebMouseEvent& event) = 0; | 81 virtual bool WillHandleMouseEvent(const blink::WebMouseEvent& event) = 0; |
| 90 | 82 |
| 91 protected: | 83 protected: |
| 92 virtual ~RenderWidgetInputHandlerDelegate() {} | 84 virtual ~RenderWidgetInputHandlerDelegate() {} |
| 93 }; | 85 }; |
| 94 | 86 |
| 95 } // namespace content | 87 } // namespace content |
| 96 | 88 |
| 97 #endif // CONTENT_RENDERER_INPUT_RENDER_WIDGET_INPUT_HANDLER_DELEGATE_H_ | 89 #endif // CONTENT_RENDERER_INPUT_RENDER_WIDGET_INPUT_HANDLER_DELEGATE_H_ |
| OLD | NEW |