| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_CLIENT_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_CLIENT_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_CLIENT_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "ui/gfx/geometry/point.h" | 9 #include "ui/gfx/geometry/point.h" |
| 10 #include "ui/gfx/geometry/size_f.h" | 10 #include "ui/gfx/geometry/size_f.h" |
| 11 #include "ui/gfx/geometry/vector2d_f.h" | 11 #include "ui/gfx/geometry/vector2d_f.h" |
| 12 | 12 |
| 13 namespace android_webview { | 13 namespace android_webview { |
| 14 struct ParentCompositorDrawConstraints; | 14 struct ParentCompositorDrawConstraints; |
| 15 | 15 |
| 16 class BrowserViewRendererClient { | 16 class BrowserViewRendererClient { |
| 17 public: | 17 public: |
| 18 // Request DrawGL to be in called AwDrawGLInfo::kModeProcess type. | |
| 19 // |wait_for_completion| will cause the call to block until DrawGL has | |
| 20 // happened. The callback may never be made, and the mode may be promoted to | |
| 21 // kModeDraw. | |
| 22 virtual bool RequestDrawGL(bool wait_for_completion) = 0; | |
| 23 | 18 |
| 24 // Called when a new Picture is available. Needs to be enabled | 19 // Called when a new Picture is available. Needs to be enabled |
| 25 // via the EnableOnNewPicture method. | 20 // via the EnableOnNewPicture method. |
| 26 virtual void OnNewPicture() = 0; | 21 virtual void OnNewPicture() = 0; |
| 27 | 22 |
| 28 // Called to trigger view invalidations. | 23 // Called to trigger view invalidations. |
| 29 // This calls postInvalidateOnAnimation if outside of a vsync, otherwise it | 24 // This calls postInvalidateOnAnimation if outside of a vsync, otherwise it |
| 30 // calls invalidate. | 25 // calls invalidate. |
| 31 virtual void PostInvalidate() = 0; | 26 virtual void PostInvalidate() = 0; |
| 32 | 27 |
| 33 // Call postInvalidateOnAnimation for invalidations. This is only used to | |
| 34 // synchronize draw functor destruction. | |
| 35 virtual void DetachFunctorFromView() = 0; | |
| 36 | |
| 37 // Called to get view's absolute location on the screen. | 28 // Called to get view's absolute location on the screen. |
| 38 virtual gfx::Point GetLocationOnScreen() = 0; | 29 virtual gfx::Point GetLocationOnScreen() = 0; |
| 39 | 30 |
| 40 // Try to set the view's scroll offset to |new_value|. | 31 // Try to set the view's scroll offset to |new_value|. |
| 41 virtual void ScrollContainerViewTo(const gfx::Vector2d& new_value) = 0; | 32 virtual void ScrollContainerViewTo(const gfx::Vector2d& new_value) = 0; |
| 42 | 33 |
| 43 // Sets the following: | 34 // Sets the following: |
| 44 // view's scroll offset cap to |max_scroll_offset|, | 35 // view's scroll offset cap to |max_scroll_offset|, |
| 45 // current contents_size to |contents_size_dip|, | 36 // current contents_size to |contents_size_dip|, |
| 46 // the current page scale to |page_scale_factor| and page scale limits | 37 // the current page scale to |page_scale_factor| and page scale limits |
| 47 // to |min_page_scale_factor|..|max_page_scale_factor|. | 38 // to |min_page_scale_factor|..|max_page_scale_factor|. |
| 48 virtual void UpdateScrollState(const gfx::Vector2d& max_scroll_offset, | 39 virtual void UpdateScrollState(const gfx::Vector2d& max_scroll_offset, |
| 49 const gfx::SizeF& contents_size_dip, | 40 const gfx::SizeF& contents_size_dip, |
| 50 float page_scale_factor, | 41 float page_scale_factor, |
| 51 float min_page_scale_factor, | 42 float min_page_scale_factor, |
| 52 float max_page_scale_factor) = 0; | 43 float max_page_scale_factor) = 0; |
| 53 | 44 |
| 54 // Handle overscroll. | 45 // Handle overscroll. |
| 55 virtual void DidOverscroll(const gfx::Vector2d& overscroll_delta, | 46 virtual void DidOverscroll(const gfx::Vector2d& overscroll_delta, |
| 56 const gfx::Vector2dF& overscroll_velocity) = 0; | 47 const gfx::Vector2dF& overscroll_velocity) = 0; |
| 57 | 48 |
| 58 // Visible for testing | |
| 59 // Called when the parent draw constraints in browser view renderer gets | |
| 60 // updated. | |
| 61 virtual void ParentDrawConstraintsUpdated( | |
| 62 const ParentCompositorDrawConstraints& draw_constraints) = 0; | |
| 63 | |
| 64 protected: | 49 protected: |
| 65 virtual ~BrowserViewRendererClient() {} | 50 virtual ~BrowserViewRendererClient() {} |
| 66 }; | 51 }; |
| 67 | 52 |
| 68 } // namespace android_webview | 53 } // namespace android_webview |
| 69 | 54 |
| 70 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_CLIENT_H_ | 55 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_CLIENT_H_ |
| OLD | NEW |