| 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_SYNCHRONOUS_INPUT_HANDLER_PROXY_H_ | 5 #ifndef UI_EVENTS_BLINK_SYNCHRONOUS_INPUT_HANDLER_PROXY_H_ |
| 6 #define CONTENT_RENDERER_INPUT_SYNCHRONOUS_INPUT_HANDLER_PROXY_H_ | 6 #define UI_EVENTS_BLINK_SYNCHRONOUS_INPUT_HANDLER_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "content/common/content_export.h" | |
| 10 | 9 |
| 11 namespace gfx { | 10 namespace gfx { |
| 12 class ScrollOffset; | 11 class ScrollOffset; |
| 13 class SizeF; | 12 class SizeF; |
| 14 } | 13 } |
| 15 | 14 |
| 16 namespace content { | 15 namespace ui { |
| 17 | 16 |
| 18 class CONTENT_EXPORT SynchronousInputHandler { | 17 class SynchronousInputHandler { |
| 19 public: | 18 public: |
| 20 virtual ~SynchronousInputHandler() {} | 19 virtual ~SynchronousInputHandler() {} |
| 21 | 20 |
| 22 // Informs the Android WebView embedder that a fling animation is running, and | 21 // Informs the Android WebView embedder that a fling animation is running, and |
| 23 // that it should call SynchronouslyAnimate() if it wants to execute that | 22 // that it should call SynchronouslyAnimate() if it wants to execute that |
| 24 // animation. The embedder/app may choose to override and ignore the | 23 // animation. The embedder/app may choose to override and ignore the |
| 25 // request for animation. | 24 // request for animation. |
| 26 virtual void SetNeedsSynchronousAnimateInput() = 0; | 25 virtual void SetNeedsSynchronousAnimateInput() = 0; |
| 27 | 26 |
| 28 // Informs the Android WebView embedder of the current root scroll and page | 27 // Informs the Android WebView embedder of the current root scroll and page |
| 29 // scale state. | 28 // scale state. |
| 30 virtual void UpdateRootLayerState( | 29 virtual void UpdateRootLayerState( |
| 31 const gfx::ScrollOffset& total_scroll_offset, | 30 const gfx::ScrollOffset& total_scroll_offset, |
| 32 const gfx::ScrollOffset& max_scroll_offset, | 31 const gfx::ScrollOffset& max_scroll_offset, |
| 33 const gfx::SizeF& scrollable_size, | 32 const gfx::SizeF& scrollable_size, |
| 34 float page_scale_factor, | 33 float page_scale_factor, |
| 35 float min_page_scale_factor, | 34 float min_page_scale_factor, |
| 36 float max_page_scale_factor) = 0; | 35 float max_page_scale_factor) = 0; |
| 37 }; | 36 }; |
| 38 | 37 |
| 39 // Android WebView requires synchronous scrolling from the WebView application. | 38 // Android WebView requires synchronous scrolling from the WebView application. |
| 40 // This interface provides support for that behaviour. The WebView embedder will | 39 // This interface provides support for that behaviour. The WebView embedder will |
| 41 // act as the InputHandler for controlling the timing of input (fling) | 40 // act as the InputHandler for controlling the timing of input (fling) |
| 42 // animations. | 41 // animations. |
| 43 class CONTENT_EXPORT SynchronousInputHandlerProxy { | 42 class SynchronousInputHandlerProxy { |
| 44 public: | 43 public: |
| 45 virtual ~SynchronousInputHandlerProxy() {} | 44 virtual ~SynchronousInputHandlerProxy() {} |
| 46 | 45 |
| 47 // Tell the proxy that we will control the timing of root fling animations | 46 // Tell the proxy that we will control the timing of root fling animations |
| 48 // from the SynchronousInputHandler. Once this is set, the InputHandler is | 47 // from the SynchronousInputHandler. Once this is set, the InputHandler is |
| 49 // not requested to Animate() the InputHandlerProxy for root layer flings. | 48 // not requested to Animate() the InputHandlerProxy for root layer flings. |
| 50 // Instead, requests for animation will go to the SynchronousInputHandler and | 49 // Instead, requests for animation will go to the SynchronousInputHandler and |
| 51 // animation ticks will only come back through SynchronouslyAnimate(). | 50 // animation ticks will only come back through SynchronouslyAnimate(). |
| 52 // Non-root flings are not affected. | 51 // Non-root flings are not affected. |
| 53 virtual void SetOnlySynchronouslyAnimateRootFlings( | 52 virtual void SetOnlySynchronouslyAnimateRootFlings( |
| 54 SynchronousInputHandler* synchronous_input_handler) = 0; | 53 SynchronousInputHandler* synchronous_input_handler) = 0; |
| 55 | 54 |
| 56 // Tick input (fling) animations. This may happen out of phase with the frame | 55 // Tick input (fling) animations. This may happen out of phase with the frame |
| 57 // timing, or not at all, as it is controlled by the WebView application. When | 56 // timing, or not at all, as it is controlled by the WebView application. When |
| 58 // it returns, it expects the animation scroll offsets to be visible to the | 57 // it returns, it expects the animation scroll offsets to be visible to the |
| 59 // application. | 58 // application. |
| 60 virtual void SynchronouslyAnimate(base::TimeTicks time) = 0; | 59 virtual void SynchronouslyAnimate(base::TimeTicks time) = 0; |
| 61 | 60 |
| 62 // Called when the synchronous input handler wants to change the root scroll | 61 // Called when the synchronous input handler wants to change the root scroll |
| 63 // offset. Since it has the final say, this overrides values from compositor- | 62 // offset. Since it has the final say, this overrides values from compositor- |
| 64 // controlled behaviour. After the offset is applied, the | 63 // controlled behaviour. After the offset is applied, the |
| 65 // SynchronousInputHandler should be given back the result in case it differs | 64 // SynchronousInputHandler should be given back the result in case it differs |
| 66 // from what was sent. | 65 // from what was sent. |
| 67 virtual void SynchronouslySetRootScrollOffset( | 66 virtual void SynchronouslySetRootScrollOffset( |
| 68 const gfx::ScrollOffset& root_offset) = 0; | 67 const gfx::ScrollOffset& root_offset) = 0; |
| 69 }; | 68 }; |
| 70 | 69 |
| 71 } // namespace content | 70 } // namespace ui |
| 72 | 71 |
| 73 #endif // CONTENT_RENDERER_INPUT_SYNCHRONOUS_INPUT_HANDLER_PROXY_H_ | 72 #endif // UI_EVENTS_BLINK_SYNCHRONOUS_INPUT_HANDLER_PROXY_H_ |
| OLD | NEW |