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