popup_touch_handle_drawable.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2016 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_POPUP_TOUCH_HANDLE_DRAWABLE_H_
  5. #define ANDROID_WEBVIEW_BROWSER_POPUP_TOUCH_HANDLE_DRAWABLE_H_
  6. #include "ui/touch_selection/touch_handle.h"
  7. #include "base/android/jni_weak_ref.h"
  8. namespace android_webview {
  9. // Touch handle drawable backed by an Android PopupWindow.
  10. class PopupTouchHandleDrawable : public ui::TouchHandleDrawable {
  11. public:
  12. PopupTouchHandleDrawable(JNIEnv* env,
  13. jobject obj,
  14. float horizontal_padding_ratio);
  15. PopupTouchHandleDrawable(const PopupTouchHandleDrawable&) = delete;
  16. PopupTouchHandleDrawable& operator=(const PopupTouchHandleDrawable&) = delete;
  17. ~PopupTouchHandleDrawable() override;
  18. // ui::TouchHandleDrawable implementation.
  19. void SetEnabled(bool enabled) override;
  20. void SetOrientation(ui::TouchHandleOrientation orientation,
  21. bool mirror_vertical,
  22. bool mirror_horizontal) override;
  23. void SetOrigin(const gfx::PointF& origin) override;
  24. void SetAlpha(float alpha) override;
  25. gfx::RectF GetVisibleBounds() const override;
  26. float GetDrawableHorizontalPaddingRatio() const override;
  27. private:
  28. JavaObjectWeakGlobalRef java_ref_;
  29. const float drawable_horizontal_padding_ratio_;
  30. };
  31. } // namespace android_webview
  32. #endif // ANDROID_WEBVIEW_BROWSER_POPUP_TOUCH_HANDLE_DRAWABLE_H_