Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: content/browser/android/popup_touch_handle_drawable.cc

Issue 701823002: Separate out Touch Selection Orientation enum (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/android/composited_touch_handle_drawable.cc ('k') | content/content.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
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 ui::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 Java_PopupTouchHandleDrawable_setOrientation(env, obj,
37 case ui::TOUCH_HANDLE_LEFT: 37 static_cast<int>(orientation));
38 Java_PopupTouchHandleDrawable_setLeftOrientation(env, obj);
39 break;
40
41 case ui::TOUCH_HANDLE_RIGHT:
42 Java_PopupTouchHandleDrawable_setRightOrientation(env, obj);
43 break;
44
45 case ui::TOUCH_HANDLE_CENTER:
46 Java_PopupTouchHandleDrawable_setCenterOrientation(env, obj);
47 break;
48
49 case ui::TOUCH_HANDLE_ORIENTATION_UNDEFINED:
50 NOTREACHED() << "Invalid touch handle orientation.";
51 };
52 } 38 }
53 39
54 void PopupTouchHandleDrawable::SetAlpha(float alpha) { 40 void PopupTouchHandleDrawable::SetAlpha(float alpha) {
55 JNIEnv* env = base::android::AttachCurrentThread(); 41 JNIEnv* env = base::android::AttachCurrentThread();
56 bool visible = alpha > 0; 42 bool visible = alpha > 0;
57 Java_PopupTouchHandleDrawable_setVisible(env, drawable_.obj(), visible); 43 Java_PopupTouchHandleDrawable_setVisible(env, drawable_.obj(), visible);
58 } 44 }
59 45
60 void PopupTouchHandleDrawable::SetFocus(const gfx::PointF& position) { 46 void PopupTouchHandleDrawable::SetFocus(const gfx::PointF& position) {
61 const gfx::PointF position_pix = gfx::ScalePoint(position, dpi_scale_); 47 const gfx::PointF position_pix = gfx::ScalePoint(position, dpi_scale_);
(...skipping 11 matching lines...) Expand all
73 Java_PopupTouchHandleDrawable_getVisibleHeight(env, drawable_.obj())); 59 Java_PopupTouchHandleDrawable_getVisibleHeight(env, drawable_.obj()));
74 return gfx::ScaleRect(unscaled_rect, 1.f / dpi_scale_); 60 return gfx::ScaleRect(unscaled_rect, 1.f / dpi_scale_);
75 } 61 }
76 62
77 // static 63 // static
78 bool PopupTouchHandleDrawable::RegisterPopupTouchHandleDrawable(JNIEnv* env) { 64 bool PopupTouchHandleDrawable::RegisterPopupTouchHandleDrawable(JNIEnv* env) {
79 return RegisterNativesImpl(env); 65 return RegisterNativesImpl(env);
80 } 66 }
81 67
82 } // namespace content 68 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/composited_touch_handle_drawable.cc ('k') | content/content.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698