| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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_ANDROID_BLIMP_VIEW_H_ | |
| 6 #define BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_ | |
| 7 | |
| 8 #include "base/android/jni_android.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "ui/gfx/native_widget_types.h" | |
| 12 | |
| 13 namespace gfx { | |
| 14 class Size; | |
| 15 } | |
| 16 | |
| 17 namespace blimp { | |
| 18 namespace client { | |
| 19 | |
| 20 class BlimpCompositorAndroid; | |
| 21 class RenderWidgetFeature; | |
| 22 | |
| 23 // The native component of org.chromium.blimp.BlimpView. This builds and | |
| 24 // maintains a BlimpCompositorAndroid and handles notifying the compositor of | |
| 25 // SurfaceView surface changes (size, creation, destruction, etc.). | |
| 26 class BlimpView { | |
| 27 public: | |
| 28 static bool RegisterJni(JNIEnv* env); | |
| 29 | |
| 30 // |real_size| is the total display area including system decorations (see | |
| 31 // android.view.Display.getRealSize()). |size| is the total display | |
| 32 // area not including system decorations (see android.view.Display.getSize()). | |
| 33 // |dp_to_px| is the scale factor that is required to convert dp (device | |
| 34 // pixels) to px. | |
| 35 BlimpView(JNIEnv* env, | |
| 36 const base::android::JavaParamRef<jobject>& jobj, | |
| 37 const gfx::Size& real_size, | |
| 38 const gfx::Size& size, | |
| 39 float dp_to_px, | |
| 40 RenderWidgetFeature* render_widget_feature); | |
| 41 | |
| 42 // Methods called from Java via JNI. | |
| 43 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); | |
| 44 void SetNeedsComposite(JNIEnv* env, | |
| 45 const base::android::JavaParamRef<jobject>& jobj); | |
| 46 void OnSurfaceChanged(JNIEnv* env, | |
| 47 const base::android::JavaParamRef<jobject>& jobj, | |
| 48 jint format, | |
| 49 jint width, | |
| 50 jint height, | |
| 51 const base::android::JavaParamRef<jobject>& jsurface); | |
| 52 void OnSurfaceCreated(JNIEnv* env, | |
| 53 const base::android::JavaParamRef<jobject>& jobj); | |
| 54 void OnSurfaceDestroyed(JNIEnv* env, | |
| 55 const base::android::JavaParamRef<jobject>& jobj); | |
| 56 void SetVisibility(JNIEnv* env, | |
| 57 const base::android::JavaParamRef<jobject>& jobj, | |
| 58 jboolean visible); | |
| 59 jboolean OnTouchEvent( | |
| 60 JNIEnv* env, | |
| 61 const base::android::JavaParamRef<jobject>& obj, | |
| 62 const base::android::JavaParamRef<jobject>& motion_event, | |
| 63 jlong time_ms, | |
| 64 jint android_action, | |
| 65 jint pointer_count, | |
| 66 jint history_size, | |
| 67 jint action_index, | |
| 68 jfloat pos_x_0, | |
| 69 jfloat pos_y_0, | |
| 70 jfloat pos_x_1, | |
| 71 jfloat pos_y_1, | |
| 72 jint pointer_id_0, | |
| 73 jint pointer_id_1, | |
| 74 jfloat touch_major_0, | |
| 75 jfloat touch_major_1, | |
| 76 jfloat touch_minor_0, | |
| 77 jfloat touch_minor_1, | |
| 78 jfloat orientation_0, | |
| 79 jfloat orientation_1, | |
| 80 jfloat tilt_0, | |
| 81 jfloat tilt_1, | |
| 82 jfloat raw_pos_x, | |
| 83 jfloat raw_pos_y, | |
| 84 jint android_tool_type_0, | |
| 85 jint android_tool_type_1, | |
| 86 jint android_button_state, | |
| 87 jint android_meta_state); | |
| 88 | |
| 89 private: | |
| 90 virtual ~BlimpView(); | |
| 91 | |
| 92 void ReleaseAcceleratedWidget(); | |
| 93 | |
| 94 // Reference to the Java object which owns this class. | |
| 95 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | |
| 96 | |
| 97 const float device_scale_factor_; | |
| 98 | |
| 99 scoped_ptr<BlimpCompositorAndroid> compositor_; | |
| 100 | |
| 101 // The format of the current surface owned by |compositor_|. See | |
| 102 // android.graphics.PixelFormat.java. | |
| 103 int current_surface_format_; | |
| 104 | |
| 105 gfx::AcceleratedWidget window_; | |
| 106 | |
| 107 DISALLOW_COPY_AND_ASSIGN(BlimpView); | |
| 108 }; | |
| 109 | |
| 110 } // namespace client | |
| 111 } // namespace blimp | |
| 112 | |
| 113 #endif // BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_ | |
| OLD | NEW |