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 #include "content/browser/android/popup_touch_handle_drawable.h" | 5 #include "content/browser/android/popup_touch_handle_drawable.h" |
6 | 6 |
7 #include "jni/PopupTouchHandleDrawable_jni.h" | 7 #include "jni/PopupTouchHandleDrawable_jni.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 void PopupTouchHandleDrawable::SetEnabled(bool enabled) { | 24 void PopupTouchHandleDrawable::SetEnabled(bool enabled) { |
25 JNIEnv* env = base::android::AttachCurrentThread(); | 25 JNIEnv* env = base::android::AttachCurrentThread(); |
26 if (enabled) | 26 if (enabled) |
27 Java_PopupTouchHandleDrawable_show(env, drawable_.obj()); | 27 Java_PopupTouchHandleDrawable_show(env, drawable_.obj()); |
28 else | 28 else |
29 Java_PopupTouchHandleDrawable_hide(env, drawable_.obj()); | 29 Java_PopupTouchHandleDrawable_hide(env, drawable_.obj()); |
30 } | 30 } |
31 | 31 |
32 void PopupTouchHandleDrawable::SetOrientation( | 32 void PopupTouchHandleDrawable::SetOrientation( |
33 TouchHandleOrientation orientation) { | 33 ui::TouchHandleOrientation orientation) { |
34 JNIEnv* env = base::android::AttachCurrentThread(); | 34 JNIEnv* env = base::android::AttachCurrentThread(); |
35 jobject obj = drawable_.obj(); | 35 jobject obj = drawable_.obj(); |
36 switch (orientation) { | 36 switch (orientation) { |
37 case TOUCH_HANDLE_LEFT: | 37 case ui::TOUCH_HANDLE_LEFT: |
38 Java_PopupTouchHandleDrawable_setLeftOrientation(env, obj); | 38 Java_PopupTouchHandleDrawable_setLeftOrientation(env, obj); |
39 break; | 39 break; |
40 | 40 |
41 case TOUCH_HANDLE_RIGHT: | 41 case ui::TOUCH_HANDLE_RIGHT: |
42 Java_PopupTouchHandleDrawable_setRightOrientation(env, obj); | 42 Java_PopupTouchHandleDrawable_setRightOrientation(env, obj); |
43 break; | 43 break; |
44 | 44 |
45 case TOUCH_HANDLE_CENTER: | 45 case ui::TOUCH_HANDLE_CENTER: |
46 Java_PopupTouchHandleDrawable_setCenterOrientation(env, obj); | 46 Java_PopupTouchHandleDrawable_setCenterOrientation(env, obj); |
47 break; | 47 break; |
48 | 48 |
49 case TOUCH_HANDLE_ORIENTATION_UNDEFINED: | 49 case ui::TOUCH_HANDLE_ORIENTATION_UNDEFINED: |
50 NOTREACHED() << "Invalid touch handle orientation."; | 50 NOTREACHED() << "Invalid touch handle orientation."; |
51 }; | 51 }; |
52 } | 52 } |
53 | 53 |
54 void PopupTouchHandleDrawable::SetAlpha(float alpha) { | 54 void PopupTouchHandleDrawable::SetAlpha(float alpha) { |
55 JNIEnv* env = base::android::AttachCurrentThread(); | 55 JNIEnv* env = base::android::AttachCurrentThread(); |
56 bool visible = alpha > 0; | 56 bool visible = alpha > 0; |
57 Java_PopupTouchHandleDrawable_setVisible(env, drawable_.obj(), visible); | 57 Java_PopupTouchHandleDrawable_setVisible(env, drawable_.obj(), visible); |
58 } | 58 } |
59 | 59 |
(...skipping 14 matching lines...) Expand all Loading... |
74 rect_pix.width(), | 74 rect_pix.width(), |
75 rect_pix.height()); | 75 rect_pix.height()); |
76 } | 76 } |
77 | 77 |
78 // static | 78 // static |
79 bool PopupTouchHandleDrawable::RegisterPopupTouchHandleDrawable(JNIEnv* env) { | 79 bool PopupTouchHandleDrawable::RegisterPopupTouchHandleDrawable(JNIEnv* env) { |
80 return RegisterNativesImpl(env); | 80 return RegisterNativesImpl(env); |
81 } | 81 } |
82 | 82 |
83 } // namespace content | 83 } // namespace content |
OLD | NEW |