OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BLIMP_CLIENT_CORE_CONTENTS_ANDROID_BLIMP_VIEW_H_ | |
6 #define BLIMP_CLIENT_CORE_CONTENTS_ANDROID_BLIMP_VIEW_H_ | |
7 | |
8 #include <jni.h> | |
9 | |
10 #include "base/android/jni_android.h" | |
11 #include "base/android/scoped_java_ref.h" | |
12 | |
13 namespace ui { | |
14 class WindowAndroid; | |
15 } // namespace ui | |
16 | |
17 namespace blimp { | |
18 namespace client { | |
19 | |
20 class BlimpContentsViewImpl; | |
21 | |
22 // The JNI bridge for the Java BlimpView that will provide hooks to the Android | |
23 // framework to interact with the content. The Java object is created by | |
24 // constructed and owned by the native class. | |
25 class BlimpView { | |
26 public: | |
27 static bool RegisterJni(JNIEnv* env); | |
28 | |
29 // |blimp_contents_view| must be the BlimpContentsView that owns this | |
30 // BlimpView. |window| should also be the WindowAndroid that the | |
31 // corresponding BlimpContents was created with. | |
32 explicit BlimpView(ui::WindowAndroid* window, | |
33 BlimpContentsViewImpl* blimp_contents_view); | |
34 ~BlimpView(); | |
35 | |
36 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | |
37 | |
38 // Creates a new ViewAndroidDelegate for this view. | |
39 base::android::ScopedJavaLocalRef<jobject> CreateViewAndroidDelegate(); | |
40 | |
41 void OnSizeChanged(JNIEnv* env, | |
42 const base::android::JavaParamRef<jobject>& jobj, | |
43 jint width, | |
44 jint height, | |
45 jfloat device_scale_factor_dp_to_px); | |
46 | |
47 jboolean OnTouchEvent( | |
48 JNIEnv* env, | |
49 const base::android::JavaParamRef<jobject>& obj, | |
50 const base::android::JavaParamRef<jobject>& motion_event, | |
51 jlong time_ms, | |
52 jint android_action, | |
53 jint pointer_count, | |
54 jint history_size, | |
55 jint action_index, | |
56 jfloat pos_x_0, | |
57 jfloat pos_y_0, | |
58 jfloat pos_x_1, | |
59 jfloat pos_y_1, | |
60 jint pointer_id_0, | |
61 jint pointer_id_1, | |
62 jfloat touch_major_0, | |
63 jfloat touch_major_1, | |
64 jfloat touch_minor_0, | |
65 jfloat touch_minor_1, | |
66 jfloat orientation_0, | |
67 jfloat orientation_1, | |
68 jfloat tilt_0, | |
69 jfloat tilt_1, | |
70 jfloat raw_pos_x, | |
71 jfloat raw_pos_y, | |
72 jint android_tool_type_0, | |
73 jint android_tool_type_1, | |
74 jint android_button_state, | |
75 jint android_meta_state, | |
76 jfloat device_scale_factor_dp_to_px); | |
77 | |
78 private: | |
79 // The BlimpContentsViewImpl that this BlimpView is used for. | |
80 // TODO(nyquist): Use a delegate instead of the BlimpContentsImpl. | |
81 BlimpContentsViewImpl* blimp_contents_view_; | |
82 | |
83 // The Java object for this BlimpView. | |
84 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | |
85 | |
86 DISALLOW_COPY_AND_ASSIGN(BlimpView); | |
87 }; | |
88 | |
89 } // namespace client | |
90 } // namespace blimp | |
91 | |
92 #endif // BLIMP_CLIENT_CORE_CONTENTS_ANDROID_BLIMP_VIEW_H_ | |
OLD | NEW |