| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_ANDROID_POPUP_TOUCH_HANDLE_DRAWABLE_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_POPUP_TOUCH_HANDLE_DRAWABLE_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_POPUP_TOUCH_HANDLE_DRAWABLE_H_ | 6 #define CONTENT_BROWSER_ANDROID_POPUP_TOUCH_HANDLE_DRAWABLE_H_ |
| 7 | 7 |
| 8 #include "ui/touch_selection/touch_handle.h" | 8 #include "ui/touch_selection/touch_handle.h" |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
| 13 #include "base/android/jni_weak_ref.h" | 13 #include "base/android/jni_weak_ref.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace android_webview { |
| 17 | |
| 18 class ContentViewCore; | |
| 19 | 17 |
| 20 // Touch handle drawable backed by an Android PopupWindow. | 18 // Touch handle drawable backed by an Android PopupWindow. |
| 21 class PopupTouchHandleDrawable : public ui::TouchHandleDrawable { | 19 class PopupTouchHandleDrawable : public ui::TouchHandleDrawable { |
| 22 public: | 20 public: |
| 23 static std::unique_ptr<PopupTouchHandleDrawable> Create( | 21 PopupTouchHandleDrawable(JNIEnv* env, jobject obj, float dpi_scale, |
| 24 ContentViewCore* content_view_core, | 22 float horizontal_padding_ratio); |
| 25 float dpi_scale); | |
| 26 ~PopupTouchHandleDrawable() override; | 23 ~PopupTouchHandleDrawable() override; |
| 27 | 24 |
| 25 static bool RegisterPopupTouchHandleDrawable(JNIEnv* env); |
| 26 |
| 28 // ui::TouchHandleDrawable implementation. | 27 // ui::TouchHandleDrawable implementation. |
| 29 void SetEnabled(bool enabled) override; | 28 void SetEnabled(bool enabled) override; |
| 30 void SetOrientation(ui::TouchHandleOrientation orientation, | 29 void SetOrientation(ui::TouchHandleOrientation orientation, |
| 31 bool mirror_vertical, | 30 bool mirror_vertical, |
| 32 bool mirror_horizontal) override; | 31 bool mirror_horizontal) override; |
| 33 void SetOrigin(const gfx::PointF& origin) override; | 32 void SetOrigin(const gfx::PointF& origin) override; |
| 34 void SetAlpha(float alpha) override; | 33 void SetAlpha(float alpha) override; |
| 35 gfx::RectF GetVisibleBounds() const override; | 34 gfx::RectF GetVisibleBounds() const override; |
| 36 float GetDrawableHorizontalPaddingRatio() const override; | 35 float GetDrawableHorizontalPaddingRatio() const override; |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 PopupTouchHandleDrawable(JNIEnv* env, jobject obj, float dpi_scale); | |
| 40 | 38 |
| 41 JavaObjectWeakGlobalRef java_ref_; | 39 JavaObjectWeakGlobalRef java_ref_; |
| 42 | 40 |
| 43 const float dpi_scale_; | 41 const float dip_scale_; |
| 44 float drawable_horizontal_padding_ratio_; | 42 const float drawable_horizontal_padding_ratio_; |
| 45 | 43 |
| 46 DISALLOW_COPY_AND_ASSIGN(PopupTouchHandleDrawable); | 44 DISALLOW_COPY_AND_ASSIGN(PopupTouchHandleDrawable); |
| 47 }; | 45 }; |
| 48 | 46 |
| 49 } // namespace content | 47 } // namespace content |
| 50 | 48 |
| 51 #endif // CONTENT_BROWSER_ANDROID_POPUP_TOUCH_HANDLE_DRAWABLE_H_ | 49 #endif // CONTENT_BROWSER_ANDROID_POPUP_TOUCH_HANDLE_DRAWABLE_H_ |
| OLD | NEW |