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 13 matching lines...) Expand all Loading... | |
24 Java_PopupTouchHandleDrawable_show(env, drawable_.obj()); | 24 Java_PopupTouchHandleDrawable_show(env, drawable_.obj()); |
25 else | 25 else |
26 Java_PopupTouchHandleDrawable_hide(env, drawable_.obj()); | 26 Java_PopupTouchHandleDrawable_hide(env, drawable_.obj()); |
27 } | 27 } |
28 | 28 |
29 void PopupTouchHandleDrawable::SetOrientation( | 29 void PopupTouchHandleDrawable::SetOrientation( |
30 TouchHandleOrientation orientation) { | 30 TouchHandleOrientation orientation) { |
31 JNIEnv* env = base::android::AttachCurrentThread(); | 31 JNIEnv* env = base::android::AttachCurrentThread(); |
32 jobject obj = drawable_.obj(); | 32 jobject obj = drawable_.obj(); |
33 switch (orientation) { | 33 switch (orientation) { |
34 case TOUCH_HANDLE_LEFT: | 34 case TOUCH_HANDLE_LEFT: |
jdduke (slow)
2014/11/04 16:21:50
No need for the switch here, let's just remove it
AviD
2014/11/04 18:24:32
Done.
| |
35 Java_PopupTouchHandleDrawable_setLeftOrientation(env, obj); | |
36 break; | |
37 | |
38 case TOUCH_HANDLE_RIGHT: | 35 case TOUCH_HANDLE_RIGHT: |
39 Java_PopupTouchHandleDrawable_setRightOrientation(env, obj); | |
40 break; | |
41 | |
42 case TOUCH_HANDLE_CENTER: | 36 case TOUCH_HANDLE_CENTER: |
43 Java_PopupTouchHandleDrawable_setCenterOrientation(env, obj); | 37 Java_PopupTouchHandleDrawable_setOrientation(env, obj, orientation); |
44 break; | 38 break; |
45 | 39 |
46 case TOUCH_HANDLE_ORIENTATION_UNDEFINED: | 40 case TOUCH_HANDLE_ORIENTATION_UNDEFINED: |
47 NOTREACHED() << "Invalid touch handle orientation."; | 41 NOTREACHED() << "Invalid touch handle orientation."; |
48 }; | 42 }; |
49 } | 43 } |
50 | 44 |
51 void PopupTouchHandleDrawable::SetAlpha(float alpha) { | 45 void PopupTouchHandleDrawable::SetAlpha(float alpha) { |
52 JNIEnv* env = base::android::AttachCurrentThread(); | 46 JNIEnv* env = base::android::AttachCurrentThread(); |
53 Java_PopupTouchHandleDrawable_setOpacity(env, drawable_.obj(), alpha); | 47 Java_PopupTouchHandleDrawable_setOpacity(env, drawable_.obj(), alpha); |
(...skipping 21 matching lines...) Expand all Loading... | |
75 rect_pix.width(), | 69 rect_pix.width(), |
76 rect_pix.height()); | 70 rect_pix.height()); |
77 } | 71 } |
78 | 72 |
79 // static | 73 // static |
80 bool PopupTouchHandleDrawable::RegisterPopupTouchHandleDrawable(JNIEnv* env) { | 74 bool PopupTouchHandleDrawable::RegisterPopupTouchHandleDrawable(JNIEnv* env) { |
81 return RegisterNativesImpl(env); | 75 return RegisterNativesImpl(env); |
82 } | 76 } |
83 | 77 |
84 } // namespace content | 78 } // namespace content |
OLD | NEW |