| 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 blimp { |
| 14 namespace client { |
| 15 |
| 16 class BlimpContentsImpl; |
| 17 |
| 18 // The JNI bridge for the Java BlimpView that will provide hooks to the Android |
| 19 // framework to interact with the content. The Java object is created by |
| 20 // constructed and owned by the native class. |
| 21 class BlimpView { |
| 22 public: |
| 23 static bool RegisterJni(JNIEnv* env); |
| 24 |
| 25 // |blimp_contents_impl| must be the BlimpContentsImpl that this BlimpView is |
| 26 // used for. |
| 27 explicit BlimpView(BlimpContentsImpl* blimp_contents_impl); |
| 28 ~BlimpView(); |
| 29 |
| 30 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
| 31 |
| 32 // Creates a new ViewAndroidDelegate for this view. |
| 33 base::android::ScopedJavaLocalRef<jobject> CreateViewAndroidDelegate(); |
| 34 |
| 35 void OnSizeChanged(JNIEnv* env, |
| 36 const base::android::JavaParamRef<jobject>& jobj, |
| 37 jint width, |
| 38 jint height, |
| 39 jfloat device_scale_factor_dp_to_px); |
| 40 |
| 41 jboolean OnTouchEvent( |
| 42 JNIEnv* env, |
| 43 const base::android::JavaParamRef<jobject>& obj, |
| 44 const base::android::JavaParamRef<jobject>& motion_event, |
| 45 jlong time_ms, |
| 46 jint android_action, |
| 47 jint pointer_count, |
| 48 jint history_size, |
| 49 jint action_index, |
| 50 jfloat pos_x_0, |
| 51 jfloat pos_y_0, |
| 52 jfloat pos_x_1, |
| 53 jfloat pos_y_1, |
| 54 jint pointer_id_0, |
| 55 jint pointer_id_1, |
| 56 jfloat touch_major_0, |
| 57 jfloat touch_major_1, |
| 58 jfloat touch_minor_0, |
| 59 jfloat touch_minor_1, |
| 60 jfloat orientation_0, |
| 61 jfloat orientation_1, |
| 62 jfloat tilt_0, |
| 63 jfloat tilt_1, |
| 64 jfloat raw_pos_x, |
| 65 jfloat raw_pos_y, |
| 66 jint android_tool_type_0, |
| 67 jint android_tool_type_1, |
| 68 jint android_button_state, |
| 69 jint android_meta_state, |
| 70 jfloat device_scale_factor_dp_to_px); |
| 71 |
| 72 private: |
| 73 // The BlimpContentsImpl that this BlimpView is used for. |
| 74 // TODO(nyquist): Use a delegate instead of the BlimpContentsImpl. |
| 75 BlimpContentsImpl* blimp_contents_impl_; |
| 76 |
| 77 // The Java object for this BlimpView. |
| 78 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
| 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(BlimpView); |
| 81 }; |
| 82 |
| 83 } // namespace client |
| 84 } // namespace blimp |
| 85 |
| 86 #endif // BLIMP_CLIENT_CORE_CONTENTS_ANDROID_BLIMP_VIEW_H_ |
| OLD | NEW |