| 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 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 content { |
| 17 | 17 |
| 18 class ContentViewCore; | 18 class ContentViewCore; |
| 19 | 19 |
| 20 // Touch handle drawable backed by an Android PopupWindow. | 20 // Touch handle drawable backed by an Android PopupWindow. |
| 21 class PopupTouchHandleDrawable : public ui::TouchHandleDrawable { | 21 class PopupTouchHandleDrawable : public ui::TouchHandleDrawable { |
| 22 public: | 22 public: |
| 23 static std::unique_ptr<PopupTouchHandleDrawable> Create( | 23 static std::unique_ptr<PopupTouchHandleDrawable> Create( |
| 24 ContentViewCore* content_view_core); | 24 ContentViewCore* content_view_core, |
| 25 float dpi_scale); |
| 25 ~PopupTouchHandleDrawable() override; | 26 ~PopupTouchHandleDrawable() override; |
| 26 | 27 |
| 27 // ui::TouchHandleDrawable implementation. | 28 // ui::TouchHandleDrawable implementation. |
| 28 void SetEnabled(bool enabled) override; | 29 void SetEnabled(bool enabled) override; |
| 29 void SetOrientation(ui::TouchHandleOrientation orientation, | 30 void SetOrientation(ui::TouchHandleOrientation orientation, |
| 30 bool mirror_vertical, | 31 bool mirror_vertical, |
| 31 bool mirror_horizontal) override; | 32 bool mirror_horizontal) override; |
| 32 void SetOrigin(const gfx::PointF& origin) override; | 33 void SetOrigin(const gfx::PointF& origin) override; |
| 33 void SetAlpha(float alpha) override; | 34 void SetAlpha(float alpha) override; |
| 34 gfx::RectF GetVisibleBounds() const override; | 35 gfx::RectF GetVisibleBounds() const override; |
| 35 float GetDrawableHorizontalPaddingRatio() const override; | 36 float GetDrawableHorizontalPaddingRatio() const override; |
| 36 | 37 |
| 37 static bool RegisterPopupTouchHandleDrawable(JNIEnv* env); | 38 static bool RegisterPopupTouchHandleDrawable(JNIEnv* env); |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 PopupTouchHandleDrawable(JNIEnv* env, jobject obj, float dpi_scale); | 41 PopupTouchHandleDrawable(JNIEnv* env, jobject obj, float dpi_scale); |
| 41 | 42 |
| 42 JavaObjectWeakGlobalRef java_ref_; | 43 JavaObjectWeakGlobalRef java_ref_; |
| 43 | 44 |
| 44 const float dpi_scale_; | 45 const float dpi_scale_; |
| 45 float drawable_horizontal_padding_ratio_; | 46 float drawable_horizontal_padding_ratio_; |
| 46 | 47 |
| 47 DISALLOW_COPY_AND_ASSIGN(PopupTouchHandleDrawable); | 48 DISALLOW_COPY_AND_ASSIGN(PopupTouchHandleDrawable); |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 } // namespace content | 51 } // namespace content |
| 51 | 52 |
| 52 #endif // CONTENT_BROWSER_ANDROID_POPUP_TOUCH_HANDLE_DRAWABLE_H_ | 53 #endif // CONTENT_BROWSER_ANDROID_POPUP_TOUCH_HANDLE_DRAWABLE_H_ |
| OLD | NEW |