browser_view_renderer_client.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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
  3. // found in the LICENSE file.
  4. #ifndef ANDROID_WEBVIEW_BROWSER_GFX_BROWSER_VIEW_RENDERER_CLIENT_H_
  5. #define ANDROID_WEBVIEW_BROWSER_GFX_BROWSER_VIEW_RENDERER_CLIENT_H_
  6. #include "base/android/scoped_java_ref.h"
  7. #include "ui/gfx/geometry/point.h"
  8. #include "ui/gfx/geometry/size_f.h"
  9. #include "ui/gfx/geometry/vector2d_f.h"
  10. namespace ui {
  11. class TouchHandleDrawable;
  12. }
  13. namespace android_webview {
  14. class BrowserViewRendererClient {
  15. public:
  16. // Called when a new Picture is available. Needs to be enabled
  17. // via the EnableOnNewPicture method.
  18. virtual void OnNewPicture() = 0;
  19. // Called to trigger view invalidations.
  20. // This calls postInvalidateOnAnimation if outside of a vsync, otherwise it
  21. // calls invalidate.
  22. virtual void PostInvalidate(bool inside_vsync) = 0;
  23. // Called to get view's absolute location on the screen.
  24. virtual gfx::Point GetLocationOnScreen() = 0;
  25. // Try to set the view's scroll offset to |new_value|.
  26. virtual void ScrollContainerViewTo(const gfx::Point& new_value) = 0;
  27. // Sets the following:
  28. // view's scroll offset cap to |max_scroll_offset|,
  29. // current contents_size to |contents_size_dip|,
  30. // the current page scale to |page_scale_factor| and page scale limits
  31. // to |min_page_scale_factor|..|max_page_scale_factor|.
  32. virtual void UpdateScrollState(const gfx::Point& max_scroll_offset,
  33. const gfx::SizeF& contents_size_dip,
  34. float page_scale_factor,
  35. float min_page_scale_factor,
  36. float max_page_scale_factor) = 0;
  37. // Handle overscroll.
  38. virtual void DidOverscroll(const gfx::Vector2d& overscroll_delta,
  39. const gfx::Vector2dF& overscroll_velocity,
  40. bool inside_vsync) = 0;
  41. // Create a text selection handle on demand.
  42. virtual ui::TouchHandleDrawable* CreateDrawable() = 0;
  43. // Called when the view tree force dark state changes
  44. virtual void OnViewTreeForceDarkStateChanged(
  45. bool view_tree_force_dark_state) = 0;
  46. protected:
  47. virtual ~BrowserViewRendererClient() {}
  48. };
  49. } // namespace android_webview
  50. #endif // ANDROID_WEBVIEW_BROWSER_GFX_BROWSER_VIEW_RENDERER_CLIENT_H_