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