| 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 | 14 |
| 15 class BrowserViewRendererClient { | 15 class BrowserViewRendererClient { |
| 16 public: | 16 public: |
| 17 // Request DrawGL to be in called AwDrawGLInfo::kModeProcess type. | 17 // Request DrawGL to be in called AwDrawGLInfo::kModeProcess type. |
| 18 // |wait_for_completion| will cause the call to block until DrawGL has | 18 // |wait_for_completion| will cause the call to block until DrawGL has |
| 19 // happened. The callback may never be made, and the mode may be promoted to | 19 // happened. The callback may never be made, and the mode may be promoted to |
| 20 // kModeDraw. | 20 // kModeDraw. |
| 21 virtual bool RequestDrawGL(bool wait_for_completion) = 0; | 21 virtual bool RequestDrawGL(bool wait_for_completion) = 0; |
| 22 | 22 |
| 23 // Called when a new Picture is available. Needs to be enabled | 23 // Called when a new Picture is available. Needs to be enabled |
| 24 // via the EnableOnNewPicture method. | 24 // via the EnableOnNewPicture method. |
| 25 virtual void OnNewPicture() = 0; | 25 virtual void OnNewPicture() = 0; |
| 26 | 26 |
| 27 // Called to trigger view invalidations. | 27 // Called to trigger view invalidations. |
| 28 // This calls postInvalidateOnAnimation if outside of a vsync, otherwise it |
| 29 // calls invalidate. |
| 28 virtual void PostInvalidate() = 0; | 30 virtual void PostInvalidate() = 0; |
| 29 | 31 |
| 30 // Call postInvalidateOnAnimation for invalidations. This is only used to | 32 // Call postInvalidateOnAnimation for invalidations. This is only used to |
| 31 // synchronize draw functor destruction. | 33 // synchronize draw functor destruction. |
| 32 virtual void InvalidateOnFunctorDestroy() = 0; | 34 virtual void InvalidateOnFunctorDestroy() = 0; |
| 33 | 35 |
| 34 // Called to get view's absolute location on the screen. | 36 // Called to get view's absolute location on the screen. |
| 35 virtual gfx::Point GetLocationOnScreen() = 0; | 37 virtual gfx::Point GetLocationOnScreen() = 0; |
| 36 | 38 |
| 37 // Try to set the view's scroll offset to |new_value|. | 39 // Try to set the view's scroll offset to |new_value|. |
| 38 virtual void ScrollContainerViewTo(gfx::Vector2d new_value) = 0; | 40 virtual void ScrollContainerViewTo(gfx::Vector2d new_value) = 0; |
| 39 | 41 |
| 40 // Is a Android view system managed fling in progress? | 42 // Is a Android view system managed fling in progress? |
| 41 virtual bool IsFlingActive() const = 0; | 43 virtual bool IsFlingActive() const = 0; |
| 42 | 44 |
| 43 // Sets the following: | 45 // Sets the following: |
| 44 // view's scroll offset cap to |max_scroll_offset|, | 46 // view's scroll offset cap to |max_scroll_offset|, |
| 45 // current contents_size to |contents_size_dip|, | 47 // current contents_size to |contents_size_dip|, |
| 46 // the current page scale to |page_scale_factor| and page scale limits | 48 // the current page scale to |page_scale_factor| and page scale limits |
| 47 // to |min_page_scale_factor|..|max_page_scale_factor|. | 49 // to |min_page_scale_factor|..|max_page_scale_factor|. |
| 48 virtual void UpdateScrollState(gfx::Vector2d max_scroll_offset, | 50 virtual void UpdateScrollState(gfx::Vector2d max_scroll_offset, |
| 49 gfx::SizeF contents_size_dip, | 51 gfx::SizeF contents_size_dip, |
| 50 float page_scale_factor, | 52 float page_scale_factor, |
| 51 float min_page_scale_factor, | 53 float min_page_scale_factor, |
| 52 float max_page_scale_factor) = 0; | 54 float max_page_scale_factor) = 0; |
| 53 | 55 |
| 54 // Handle overscroll. | 56 // Handle overscroll. |
| 55 virtual void DidOverscroll(gfx::Vector2d overscroll_delta) = 0; | 57 virtual void DidOverscroll(gfx::Vector2d overscroll_delta) = 0; |
| 56 | 58 |
| 59 // Request a vsync update. |
| 60 virtual void RequestVSyncUpdate() = 0; |
| 61 |
| 57 protected: | 62 protected: |
| 58 virtual ~BrowserViewRendererClient() {} | 63 virtual ~BrowserViewRendererClient() {} |
| 59 }; | 64 }; |
| 60 | 65 |
| 61 } // namespace android_webview | 66 } // namespace android_webview |
| 62 | 67 |
| 63 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_CLIENT_H_ | 68 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_CLIENT_H_ |
| OLD | NEW |